User forums > Using Code::Blocks
-fPIC flag is not showing in list
BlueHazzard:
The answer is (and obfuscated tried to tell you) You can add any option, that is not present in "compiler flags" to the text filed in "other compiler flags"
So if you need to add "-fPIC" you simply add this in the "other compiler flags" control. One flag per line would be the default.
Rahul:
i did it as you said buy it gives same error : -
--- Code: --------------- Build: Debug in datemanip (compiler: GNU GCC Compiler)---------------
g++ -shared obj/Debug/Adddays.o obj/Debug/Addmonths.o obj/Debug/Addyears.o obj/Debug/Cmpdate.o obj/Debug/Datefmt.o obj/Debug/Diffdays.o obj/Debug/Diffymd.o obj/Debug/Julian.o obj/Debug/Leap.o obj/Debug/Subdays.o obj/Debug/Submonths.o obj/Debug/Subyears.o obj/Debug/Valid.o obj/Debug/Weekday.o -o bin/Debug/libdatemanip.so -lfPIC
/usr/bin/ld: obj/Debug/Datefmt.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
obj/Debug/Datefmt.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
--- End code ---
i also added a flag in compiler flags
bujtist gives same error :-
--- Code: ---
-------------- Build: Debug in datemanip (compiler: GNU GCC Compiler)---------------
g++ -shared obj/Debug/Adddays.o obj/Debug/Addmonths.o obj/Debug/Addyears.o obj/Debug/Cmpdate.o obj/Debug/Datefmt.o obj/Debug/Diffdays.o obj/Debug/Diffymd.o obj/Debug/Julian.o obj/Debug/Leap.o obj/Debug/Subdays.o obj/Debug/Submonths.o obj/Debug/Subyears.o obj/Debug/Valid.o obj/Debug/Weekday.o -o bin/Debug/libdatemanip.so -fPIC -lfPIC
/usr/bin/ld: obj/Debug/Datefmt.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
obj/Debug/Datefmt.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
0 error(s), 0 warning(s) (0 minute(s), 0 second(s))
--- End code ---
Miguel Gimenez:
Those logs are from the linker, they are asking you to compile with -fPIC. You must do a clean build after changing compiler options.
BlueHazzard:
--- Quote from: Miguel Gimenez on January 15, 2019, 04:16:55 pm ---Those logs are from the linker, they are asking you to compile with -fPIC. You must do a clean build after changing compiler options.
--- End quote ---
You can do this with the menu: Build->Rebuild or Build->Clean and Build->Build
Rahul:
i did as you said. and found it is working but not showing in intellisense. And Also not in #include directive as : should be "#inlcude "main.h".
Navigation
[0] Message Index
[*] Previous page
Go to full version