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

前端 未结 2 1207
无人及你
无人及你 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: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; 
    

提交回复
热议问题