我正在尝试安装the GLUI2 library .
我按照自述文件中的说明进行操作,该说明告诉我转到 GLUI 的根目录并运行 Make。 我收到以下错误:
/usr/bin/ld: Glui2/stb_image.o: relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
我尝试在 makefile 的两个编译行中包含 -fPIC,但收到此错误消息:
/usr/bin/ld: Glui2/g2Button.o: relocation R_X86_64_32S against `_ZTV8g2Button' can not be used when making a shared object; recompile with -fPIC
Glui2/g2Button.o: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
我真的不知道这些错误告诉我什么,或者我应该做什么来解决它们。
我正在使用它为我在 OpenGL 中制作的游戏构建一个小型 UI,如果您建议一个与 GLUT 一起使用的不同库,我也会很感激这些建议...
最佳答案
Glui2/stb_image.o 是根据 Glui2/stb_image.c 文件构建的。将文件重命名为 Glui2/stb_image.cpp,并更新 makefile 中的文件名。
然后运行“make clean”,然后再次运行“make”。
它对我有用,似乎混合 c 和 cpp 文件在这个项目中效果不佳。
关于c++ - 构建 GLUI2 库 (Ubuntu),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26623250/