在Code :: Blocks中应用--enable-shared或-fPIC [英] Apply either --enable-shared or -fPIC on in Code::Blocks
问题描述
-------------- Build:Release in 39dll-4-Linux ---------------
链接动态库:./39DLL.so
/ usr / bin / ld:obj / Release / buffer.o:在创建共享对象时,不能使用针对`CBuffer :: retval'的R_X86_64_32;使用-fPIC
obj / Release / buffer.o重新编译:无法读取符号:值不正确
collect2:ld返回1退出状态
进程以状态1结束(0分钟,0秒)
0错误,0警告
:
Project-> Build Options-> Compiler Settings-> Other Options。
在左边你会看到一个包含构建目标的树。它看起来像这样:
ProjectName
Debug
Release
单击树的每个节点并为每个节点输入<$ c在文本框中输入$ c> -fPIC ,然后按OK保存。
这种方式将为所有目标添加标志。
As the question states, I need to apply either of those compiler/linker settings. I am using Code::Blocks 10.05. I've looked through all the build settings screens. I cannot find where to apply these settings. I am getting the following on output:
-------------- Build: Release in 39dll-4-Linux ---------------
Linking dynamic library: ./39DLL.so
/usr/bin/ld: obj/Release/buffer.o: relocation R_X86_64_32 against `CBuffer::retval' can not be used when making a shared object; recompile with -fPIC
obj/Release/buffer.o: could not read symbols: Bad value
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings
Go to: Project->Build Options->Compiler Settings->Other Options.
On the left you will see a tree with the build targets. It looks like this: ProjectName Debug Release
Click on each node of the tree and for each node enter -fPIC
in the text box, then press OK to save.
That way the flag will be added for all targets.
这篇关于在Code :: Blocks中应用--enable-shared或-fPIC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!