问题描述
对于以下3种编译情况:
gcc -o helloc hello.c(1)g ++ -o hellocpp hello.cpp(2)C ++ -o hellocpp hello.cpp(3)
我怎么分别知道默认包含目录",默认链接目录"和默认链接库"?我在32位Ubuntu 11.04环境中使用gcc 4.5.2.
对于情况(1),gcc是使用标准C库还是GNU C库?这两个C库之间有区别吗?
比较情况(2)和(3),编译器使用的默认链接库"是否有区别?他们使用的是标准C ++库还是GNU C ++库?这两个C ++库之间有什么区别?
预先感谢您的任何建议.
曾志伟
说 gcc -v
或 g ++ -v
以打印出有关环境的详细信息./p>
例如对我来说,这说:
#include< ...>搜索从这里开始:/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../../include/c++/4.6.2/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../../include/c++/4.6.2/i686-pc-linux-gnu/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../../include/c++/4.6.2/backward/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.2/include/usr/local/include/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.2/include-fixed/usr/include
也可以尝试使用 gcc -dumpspecs
来查看有关工具链中调用的工具的详细信息.
For the following 3 compile cases :
gcc -o helloc hello.c (1)
g++ -o hellocpp hello.cpp (2)
c++ -o hellocpp hello.cpp (3)
how do I know the "default include directories", "default link directories" and "default link libraries" in each case ? I am using gcc 4.5.2 in a 32 bit Ubuntu 11.04 environment.
For case (1), is gcc using the standard C libraries or the GNU C libraries ? Is there difference between the two C libraries ?
Comparing cases (2) and (3), is there any difference in the "default link libraries" used by the compiler ? Are they using the standard C++ libraries or the GNU C++ libraries ? What is the difference between the two C++ libraries ?
Thanks in advance for any suggestion.
Lawrence Tsang
Say gcc -v
, or g++ -v
to print out verbose information about the environment.
E.g. for me this says:
#include <...> search starts here:
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../../include/c++/4.6.2
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../../include/c++/4.6.2/i686-pc-linux-gnu
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.2/../../../../include/c++/4.6.2/backward
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.2/include
/usr/local/include
/usr/local/lib/gcc/i686-pc-linux-gnu/4.6.2/include-fixed
/usr/include
Also try gcc -dumpspecs
to see details about the invoked tools in the tool chain.
这篇关于我怎么知道“默认包含目录",“默认链接目录"和“默认链接目录"?和“默认链接库"11.04中如何安装gcc,g ++/c ++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!