簡體   English   中英

如何使用 Qt 解決“位置無關代碼”錯誤

[英]How to solve "Position Independant code" error with Qt

我正在嘗試在 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

我找到了解決我的問題的方法。

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

感謝您願意提供幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM