View Full Version : I can't get C++/Ogl/glut to compile on Linux... Please help...

10-24-2003, 12:53 AM
When I programmed in Ogl previously, I used C.
I actually compiled it on Solaris Unix, but the compilation command was the same as on Linux:
gcc source.c -L/usr/X11R6/lib -lglut -lGLU -lGL -lXmu -lXi -lXaw -lXext -lX11 -lm -o executable
Now, I've done my first asteroid game in C++. I've worked on VS .NET 2003, so no linking problems there... but I now need to make it compile on Linux... :-( and I have no makefile :-(
Could someone please tell me how to do it? (Not the makefile, but the compilation command (i.e. libraries linking etc...)
For compilers, we have gcc and g++.
Or perhaps if you'd happen to have a makefile template...
Huge thanks for the help.

10-24-2003, 02:58 AM
are you by any chance running red hat 9? I have red hat 9 and I have been having trouble compiling on linux even though glut and gl came installed on my system. On any other system all you should have do to is
g++ -c yourfile.cpp -I(you would put here the path of glut and gl if it is not in its normal place)

after you have all your objects you would do

g++ -o yourobjects -lGL -lGLU -lglut -lm

but dont forget -L(your path if the libs are not in usr/lib)

10-24-2003, 03:52 AM
It would be nice if you posted what the link error was?

Also post what version of Linux you are using?

10-24-2003, 10:42 AM
Sorry, I asked about compiling under Linux but as I wrote in the post, I'm actually compiling under Solaris Unix (which will be the same as Linux). The reason I wrote Linux is because I know more people use it as opposed to Solaris Unix :-)

10-24-2003, 11:51 AM
And the error you are getting is....??

10-24-2003, 12:14 PM
Please see my other post (about g++). I think this error has actually nothing to do with linking.... I think it's g++... :-(