g ++既是c ++编译器又是链接器? [英] Is g++ both a c++ compiler and a linker?

查看:85
本文介绍了g ++既是c ++编译器又是链接器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在查看我在Eclipse中构建的输出.我正在交叉编译ColdFire处理器.编译行如下所示:

I was looking at the output from my build in Eclipse. I'm cross compiling for a ColdFire processor. The compilation line looks like this:

m68k-elf-g++ -O2 -falign-functions=4 -IC:\nburn\include -IC:\nburn\MOD52...

之后是更多包含文件,明显的编译器"标志,最后是我更改的一个源文件.下一行再次调用相同的工具:

followed by more include file, obvious "compiler" flags and finally the one source file I changed. The next line invokes the same tool again:

m68k-elf-g++ src\main.o src\TouchPanelMediator.o src\Startup.o....

之后是更多.o文件,一些.ld文件和一些.a文件.这似乎是将所有各种类型的目标文件链接在一起.

followed by more .o files some .ld files and some .a files. This appears to be linking all the various types of object files together.

在Gnu家族中,g ++是一些uber应用程序,可以根据参数确定是否需要编译或链接?它具有内置的功能吗?还是只是将编译分派到gcc并链接到ld,而我的日志却没有显示出来?

In the Gnu family is g++ some uber application that can determine based on arguments whether it needs to compile or link? Does it have both capabilities built-in or is it just dispatching compiling to gcc and linking to ld and my log just doesn't show that?

推荐答案

g ++ gcc 驱动程序.通常,他们运行预处理器( cpp ),适当的编译器(对于C ++为 cc1plus 和对于C为 cc1 )和链接程序(gold或GNU ld)和所有其他必要的东西. gcc g ++ 之间的区别在于,后者包括一个附加的库,可以链接到( libstdc ++ ).

g++ and gcc are drivers. Usually, they run the preprocessor (cpp), compiler proper (cc1plus for C++ and cc1 for C) and the linker (gold or GNU ld) and all other things necessary. The difference between gcc and g++ is that the latter includes one additional library to link against (libstdc++).

取决于调用它们的文件类型,它们可以省略某些步骤或以不同的方式进行操作.例如,对于 .o 文件,不需要运行适当的编译器或预处理器.

Depending on what type of file they are invoked on, they may omit some steps or do things differently. For .o files, it doesn't need to run the compiler proper or the preprocessor, for example.

如果将-### 传递给他们,则可以看到它打印了在其执行的每个步骤中调用的工具.

If you pass -### to them, you can see it print the tools it invokes in each step of its execution.

这篇关于g ++既是c ++编译器又是链接器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆