Compiling GLUT Opengl Programs in Linux
Hello all..
I currently have Red Hat Linux 7.2 and I am trying to compile a opengl program that I wrote using GLUT. I know that Linux uses MESA, but I am not sure how to link the program to the appropriate libraries as it is compiled. This is easy to do in Win32, but since I am new to linux I am unfamiliar of how to do this.
IF anyone could help, I would really appreciate it.
Thanks!
Bill Blair
Thanks!John William Blair "The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of the darkness. For he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee."
http://members.home.com/chucklez/wtc/index.html
http://members.home.com/chucklez/wtc/index.html
To link a library using GCC you use -llibname (that''s an L). So, to link OpenGL we use -lGL, GLU is -lGLU, and GLUT is -lGLUT, I''m pretty sure. If you need to link another library, look in one of your library directories to find the actual file. Remove the "lib" from the front and everything after the first period, and then you have a name that can be appended to -l.


Thanks, but I believe redhat uses MESA and not OpenGL. Can anyone give me an example how to compile a program using mesa and where the libraries might be so that I can use them?
Thanks!
Thanks!
Thanks!John William Blair "The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of the darkness. For he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee."
http://members.home.com/chucklez/wtc/index.html
http://members.home.com/chucklez/wtc/index.html
MESA is OpenGL, just without the official certification from SGI. I compile OpenGL applications in Linux all the time using those extact command line options (excluding GLUT), so I''m very sure they work
.



Okay, great! I think I understand...so the command on the command line looks like this:
>gcc testgl.c -lGL -lGLU -lGLUT
Is that it? or do I just need replace GL, GLU and GLUT with the actual path names. What about object files? Do I need to create that as well? Can I create a make file to do all this?
Thanks for being patient...compiling C programs on LINUX is very new to me...
Thanks!
>gcc testgl.c -lGL -lGLU -lGLUT
Is that it? or do I just need replace GL, GLU and GLUT with the actual path names. What about object files? Do I need to create that as well? Can I create a make file to do all this?
Thanks for being patient...compiling C programs on LINUX is very new to me...
Thanks!
Thanks!John William Blair "The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of the darkness. For he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee."
http://members.home.com/chucklez/wtc/index.html
http://members.home.com/chucklez/wtc/index.html
Will someone please verify the above?
Thanks!
Thanks!
Thanks!John William Blair "The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of the darkness. For he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee."
http://members.home.com/chucklez/wtc/index.html
http://members.home.com/chucklez/wtc/index.html
quote:
Original post by jwblair
Will someone please verify the above?
Thanks!
Not sure about the glut part, but the rest is right. Its same even if you use Mesa. Finally you would have to specify path only if the libraries aren''t already in your existing path.
You can create object files like this
gcc -c file1.c
gcc -c file2.c
finally get the executable
gcc file3.c file1.o file2.o -o executable_name
Yes, you can make a file to do all of it - most programs come with a Makefile. "man make" and read a lot of makefiles.
Hello from my world
Hey thanks for the help everyone! I will try it out and let you know what happens!
Bill Blair
Bill Blair
Thanks!John William Blair "The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he who, in the name of charity and good will, shepherds the weak through the valley of the darkness. For he is truly his brother's keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee."
http://members.home.com/chucklez/wtc/index.html
http://members.home.com/chucklez/wtc/index.html
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement