Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I know the "default include directories", "default link directories" and "default link libraries" of gcc, g++/c++ in Ubuntu 11.04?

Tags:

c++

gcc

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

like image 599
user1129812 Avatar asked Jan 19 '12 03:01

user1129812


1 Answers

Kerrek SB's answer doesn't quite work for me on Ubuntu 12.04, but this seems to work:

cpp -v

Toward the bottom I get this:

#include "..." search starts here:
#include <...> search starts here:
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/4.6.1/include-fixed
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
like image 62
Tom Avatar answered Oct 12 '22 12:10

Tom