Compile Problem
could not read symbols
在剛建立完shared或static lib的專案第一次編譯時,都會出現如下方的錯誤:
Building target: libSharedLibParc.so Invoking: GCC C++ Linker g++ -shared -o"libSharedLibParc.so" ./DiskInfo.o /usr/bin/ld: ./DiskInfo.o: relocation R_X86_64_32S against `vtable for DiskInfo' can not be used when making a shared object; recompile with -fPIC ./DiskInfo.o: could not read symbols: Bad value collect2: ld returned 1 exit status make: *** [libSharedLibParc.so] Error 1
其實參考它給與的錯誤訊息,將-fPIC加在GCC C++/C Compiler的Miscellaneous中就可以編過了。
-fPIC(position independent code)用途可以參考link。
留言
張貼留言