* Param Ponnaiyan wrote on Sun, Nov 28, 2010 at 06:50:26PM CET: > If I link it this way > g++ *.o libxxx.a > everything works fine. > BUT if I convert the .o's into a library say libnew.a and separate > main into main.cpp > and link like this > g++ main.cpp libnew.a libxxx.a > then it fails.
This question is not suitable for this mailing list. Please send further replies to the gcc-help list. The ordering of libraries on the command line is important; if you have functions from libxxx.a that need functions from libnew.a living in object files not needed already, then the link fails. Reordering libraries might work, or specifying libnew.a again after libxxx.a. In extreme cases you may need to repeat both libraries several times in order to fully link them. An alternative is wrapping them in -Wl,--start-group and -Wl,--end-group. Hope that helps. Cheers, Ralf