Dosisod
Dosisod

Reputation: 347

gcc: Find directory of libstdc++

I am writing a C library which needs to statically link with a library written in C++. I can specify the location of libstdc++.a explicitly (since I am linking statically):

gcc main.c /some/library.a /usr/lib/gcc/x86_64-linux-gnu/7/libstdc++.a

I found the location for libstdc++.a by using the following:

$ g++ --print-file-name=libstdc++.a
/usr/lib/gcc/x86_64-linux-gnu/7/libstdc++.a

This is good and all, except for the fact that it uses g++ to find it. If I do the following with gcc instead:

$ gcc --print-file-name=libstdc++.a
libstdc++.a

It cannot find it. Am I missing something? Is gcc capable of doing this, or do I have to use g++?

Upvotes: 1

Views: 2478

Answers (1)

Alan Beveridge
Alan Beveridge

Reputation: 21

STL (another name of the library), is native to C++. It is written in C++. So, gcc does not have any built in support for STL. g++ support for STL is built in.

Upvotes: 1

Related Questions