开发者

GCC C++ Linker section on FC13

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:

  1. Callisto could not be installed -- nothing was found from the repository
  2. 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?


You have to tell the compiler that your program uses additional libraries.

Use the -l argument

g++ -O2 -g -Wall -fmessage-length=0  -lglut -lGL -lGLU -lX11  -c -o tw.o tw.cpp

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


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 called libmath.so or libmath.a (as the case may be).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜