Hello,

I'm using g++ on Linux and OSX to compile & link my program with libraries.
Within my build scripts I would create a "static" and "dynamic" linking option,
so I have got some problems with the correct linker flags on g++.

The dynamic linking works perfekt, I setup the libs with -l flag and the library pathes, but can I add a flag that all libs, that are referenced with -l flag are linked static if the *.a file exists? Something like "if the library with -l exists as a static lib, use them, otherwise
use the dynamic *.so / *.dylib"?

I have try to use the --static and --as-needed option in a little example:

g++ --static --as-needed -O2 -pipe -Wall -o programm programm.o
and get the error
ld: library not found for -lcrt0.o

Thanks

Phil



_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
https://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to