【问题标题】:How to solve "Position Independant code" error with Qt如何使用 Qt 解决“位置无关代码”错误
【发布时间】:2018-02-22 15:49:13
【问题描述】:

我正在尝试在 debian 上编译一些 c++/Qt 代码,但出现以下错误:

/usr/include/x86_64-linux-gnu/qt5/QtCore/qglobal.h:1113:4: error: #error "You must build your code with position independent code if Qt was built with -reduce-relocations. " "Compile your code with -fPIC (-fPIE is not enough)."
# error "You must build your code with position independent code if Qt was built with -reduce-relocations. "\

代码有一个makefile,所以基本上只是执行make命令。

请问我该怎么做才能解决这个问题?提前致谢!

编辑:请找到我要编译的代码https://github.com/juliendelile/MECAGEN

【问题讨论】:

  • 请提供您尝试运行的代码
  • 它显示了你是如何编译你的以及你用来做它的所有文件。
  • 尝试在isf/Makefile的第15行将-fPIC添加到CFLAGS变量中
  • 感谢大家的帮助。 @Paul 我认为 isf 编译没有问题。不过,我确实在 CFLAGS 中添加了 -fPIC,但我遇到了同样的错误。
  • 大家好。请问有人可以帮忙吗?

标签: c++ qt debian


【解决方案1】:

我找到了解决问题的方法。

我只需要在 mecagen/gui 的 makefile 第 50 行添加 -fPIC。

感谢您愿意提供帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-06-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-25
    • 1970-01-01
    相关资源
    最近更新 更多