linker error “relocation R_X86_64_PC32 against undefined symbol” despite compilation with -fPIC

前端 未结 2 1205
无人及你
无人及你 2021-01-19 02:57

I\'m compiling a c++ program using the command line

g++ -c prog.cc -std=c++11 -march=native -fPIC -fopenmp

and then try to make a shared ob

相关标签:
2条回答
  • 2021-01-19 03:28

    I just ran into something similar when upgrading to ubuntu 14.04. I had to add -fkeep-inline-functions to the source file that defined the 'missing' symbol. No idea if your problem is similar.

    0 讨论(0)
  • 2021-01-19 03:29

    You just need to make the default visibility hidden for your base class(handle_base). You can do this by -

    #define VISIBILITY __attribute__((visibility("hidden")))
    class VISIBILITY handle_base; 
    
    0 讨论(0)
提交回复
热议问题