海湾合作委员会 C++ FC13 上的链接器部分
我正在尝试让 OpenGL 和 Glut 在 Eclipse Linux FC13 上运行。
经过两天的研究,我承认需要帮助。在 FC13 Eclipse 上,我看到 /usr/include/GL
和 /usr/include/SDL
- 所以库就在那里。我启动了 Eclipse,然后尝试在其上运行一个简单的程序,就像此处的建议< /a>.然而,这些步骤中缺少两件事:
- 无法安装 Callisto—— 没有发现任何内容 存储库
- 在任何地方都找不到 GCC C++ 链接器 适用于 Eclipse 3.5.2。
当尝试运行该程序时,我看到以下错误:
程序不存在
程序有时
找不到二进制文件
如果我只运行“hello world”,它就可以工作,但否则,每次我尝试包含 glut gl 或 sdl 命令时都会发生这些错误。
以下是编译器错误的摘录:
make all
g++ -O2 -g -Wall -fmessage-length=0 -c -o tw.o tw.cpp
tw.cpp: In function ‘void main_loop_function()’:
g++ -o tw tw.o
是的,显然编译器无法看到 glu、gl、sdl 和 glut 库。
关于如何修复的一些建议?
I am trying to get OpenGL and Glut running on Eclipse Linux FC13.
After spending two days on it, I admit that help is needed. On FC13 Eclipse, I see/usr/include/GL
and /usr/include/SDL
-- so the libs are there. I started Eclipse, and then tried to run a simple program on it, just like suggested here. However, two things were missing in those steps:
- Callisto could not be installed --
nothing was found from the
repository - GCC C++ Linker is not found anywhere
for Eclipse 3.5.2.
When trying to run the program, I see this error:
Program does not exist
and sometimes
Binary not found
If I just run the "hello world" it works, but otherwise, those errors happen every time I try to include glut gl or sdl commands.
Here is an excerpt from the compiler error:
make all
g++ -O2 -g -Wall -fmessage-length=0 -c -o tw.o tw.cpp
tw.cpp: In function ‘void main_loop_function()’:
g++ -o tw tw.o
Yes, apparently the compiler is not able to see the glu, gl, sdl and glut libraries.
Some suggestion on how to fix?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您必须告诉编译器您的程序使用了附加库。
使用 -l 参数
这应该有助于防止不满意的链接错误。
您可以在项目的属性中设置这些。
属性->c/c++ Build->设置->工具设置->链接器
You have to tell the compiler that your program uses additional libraries.
Use the -l argument
This should help against unsatisfied link errors.
You can set these in the properties of your Project.
Properties->c/c++ Build->Settings->Tool Settings->Linker
检查编译器是否能够找到合适的头文件。如果没有,您肯定会遇到编译器错误。尝试使用
-I
选项设置适当的路径。修复该问题后,检查是否存在任何链接器错误(未定义的符号/引用或排序)。如果这样做:尝试使用
-L
选项设置库路径,并要求编译器使用-l
选项链接到特定库。请注意,后者期望类似-lmath
的内容,实际上链接的库实际上称为libmath.so
或libmath.a
(如情况可能是这样)。Check if the compiler is able to find the appropriate header files or not. If not, you are sure to get compiler errors. Try using the
-I
option to set the appropriate paths.Once you've fixed that, check if there are any linker errors (undefined symbols/references or the sort). If you do: Try to set the library paths using the
-L
option and ask the compiler to link in the specific libraries by using the-l
option. Note that the latter expects something like-lmath
where in reality the library being linked in is actually calledlibmath.so
orlibmath.a
(as the case may be).