c++ - linker error "relocation R_X86_64_PC32 against undefined symbol" despite compilation with -fPIC -
c++ - linker error "relocation R_X86_64_PC32 against undefined symbol" despite compilation with -fPIC -
i'm compiling c++ programme using command line
g++ -c prog.cc -std=c++11 -march=native -fpic -fopenmp
and seek create shared object via
g++ prog.o -shared -fopenmp -o lib/libprog.so
this has worked. today get:
/usr/bin/ld: prog.o: relocation r_x86_64_pc32 against undefined symbol `_ztvn12_global__n_111handle_basee' can not used when making shared object; recompile -fpic /usr/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status
the symbol _ztvn12_global__n_111handle_basee
de-mangles vtable (anonymous namespace)::handle_base
(handle_base
polymorphic class defined in anonymous namespace in prog.cc , yes phone call dynamic_cast<handle_base>()
.)
i'm using gcc version 4.7.0 (gcc) , gnu ld (gnu binutils; opensuse 11.1) 2.19. can help (suggest solutions [other doing without shared object or dynamic cast
])?
i ran similar when upgrading ubuntu 14.04. had add together -fkeep-inline-functions source file defined 'missing' symbol. no thought if problem similar.
c++ gcc linker-error ld fpic
Comments
Post a Comment