Click here to Skip to main content
14,733,553 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all
my problem is in making .so file in codeblocks , the project that make my .so file in older version(32 bit) is failed with following errors in new version(64 bit)
g++ -Wall -fexceptions -g -Iinclude -c /home/amini/codes/testr/main.cpp -o obj/Debug/main.o
g++ -Wall -fexceptions -g -Iinclude -c /home/amini/codes/testr/src/tester.cpp -o obj/Debug/src/tester.o
g++ -shared  obj/Debug/main.o obj/Debug/src/tester.o  -o bin/Debug/libtestr.so -fPIC  
/usr/bin/ld: obj/Debug/src/tester.o: relocation R_X86_64_PC32 against symbol `_ZTV6tester' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status


What I have tried:

when I add command to compilor option only the last command line get the -fPIC
how can I add it to all commands for making all object files,
I tested it in linux terminal it solves my problem
Posted
Updated 5-Nov-20 13:52pm
Comments
Richard MacCutchan 23-Jan-19 4:19am
   
Edit your make files or set it as a global variable, as described in the g++ documentation.
saide_a 23-Jan-19 6:27am
   
in codeblocks where can I add it
Richard MacCutchan 23-Jan-19 6:59am
   
Sorry, no idea, I have never used codeblocks. But again I would suggest you check the documentation.

by adding the -fPIC to compiler option the problem does not solve because other object files don't make with that option then you should go to setting> compiler> other setting> advance option and add -fPIC there
   
I found that closing Code::Blocks, opening it again and rebuilding my project worked.
   
I found that closing Code Blocks, opening it again and rebuilding my project worked.
   
I found that closing::Code Blocks, opening it again and rebuilding my project worked.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900