How to link using GCC without -l nor hardcoding path for a library that does not follow the libNAME.so naming convention?

前端 未结 3 1163
太阳男子
太阳男子 2020-11-29 23:35

I have a shared library that I wish to link an executable against using GCC. The shared library has a nonstandard name not of the form libNAME.so, so I can not use the usual

3条回答
  •  既然无缘
    2020-11-30 00:11

    If you can copy the shared library to the working directory when g++ is invoked then this should work:

    g++ -o build/bin/myapp _mylib.so other_source_files
    

提交回复
热议问题