How do I make an unreferenced object load in C++?

前端 未结 8 1954
一向
一向 2021-01-03 16:36

I have a .cpp file (let\'s call it statinit.cpp) compiled and linked into my executable using gcc. My main() function is

8条回答
  •  醉酒成梦
    2021-01-03 16:50

    Of course the dynamic library solution is the best, but I've also been told it's possible to link the whole static library with the linker option:

    -Wl,-whole-archive
    

    before the library's -l option, and

    -Wl,-no-whole-archive
    

    after it (to avoid including other libraries as a whole, too).

提交回复
热议问题