Hi, Stéphane Glondu <glondu@debian.org> (11/03/2011): > So you mean that by using some specific library, one should change > linker? no, I mean that by using the C++ programming language, you're supposed to link using g++. > Doesn't sound right to me... Do you have any reference that > explains why linking to -lstdc++ without g++ is bad practice? I've > already heard of that, but couldn't find any decent explanation. Because it's not guaranteed to work. Example: | $ cat foo.cpp | #include <iostream> | | using namespace std; | | int main(void) { | cout << "Hello world!" << endl; | return 0; | } | $ g++ -c foo.cpp -o foo.o | $ ld -lstdc++ foo.o -o foo | ld: cannot find -lstdc++ Both work, with the intermediate target: | g++ foo.o -o foo or directly: | $ g++ foo.cpp -o foo http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html also suggests you should be using g++ to link (see -static-*). KiBi.
Attachment:
signature.asc
Description: Digital signature