在Code :: Blocks中应用--enable-shared或-fPIC [英] Apply either --enable-shared or -fPIC on in Code::Blocks

查看:338
本文介绍了在Code :: Blocks中应用--enable-shared或-fPIC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如问题所述,我需要应用这些编译器/链接器设置。我正在使用Code :: Blocks 10.05。我浏览了所有的构建设置屏幕。我无法找到应用这些设置的位置。输出结果如下:

  -------------- 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆