g++ compiler
Hello
I use kDevelop to compile my GLUT source codes.But i dont like to make all those projects with all those files.I want to compile my GLUT using g++. In my linker options from my kDevelop i click on the libraries: X11, Xext and Math. Then i add -lglut -lGLU -lGL -lXi -lXmu to Additional Libraries. So what do i need to type on a shell to compile my GLUT c plus plus file? thanx Hylke |
my guess would be
Code:
g++ -o myprog myprog.cpp -L/usr/X11R6/lib -lglut -lGLU -lGL -lXi -lXmu -lX11 -lXext -lm btw, you might try -lMath instead of -lm |
What do u mean with putting it in a makefile?
I typed g++ -o myprog myprog.cpp -L/usr/X11R6/lib -lglut -lGLU -lGL -lXi -lXmu -lX11 -lXext -lm and g++ -o myprog myprog.cpp -L/usr/X11R6/lib -lglut -lGLU -lGL -lXi -lXmu -lX11 -lXext -lMath in a command line but both didn't work. |
Maybe you could define "didn't work" a little bit better. Like with actual error output. We can't very well tell you how to fix it if you don't tell us what error you got.
Edit: Also, you should read up on Makefiles a bit. They will make your life easier. Do a Google search, and I bet you will find tons of information explaining them. |
My errors:
Quote:
|
It appears you aren't including the source for your GameEngine class. Is that in main.cpp, or a separate .cpp file? If it's in a separate .cpp file, you will have to include that in your list like so:
g++ -o myprog main.cpp GameEngine.cpp -L/usr/X11R6/lib -lglut -lGLU -lGL -lXi -lXmu -lX11 -lXext -lm |
When i did that i got the following errors:
Quote:
i got this: Quote:
|
GameEngine.h shouldn't go on the command line; it should be #included by whatever file needs it, which it looks like it is. You need to check that GameEngine.h exists and is in the directory with GameEngine.cpp.
|
it exist and it is in the same directory.
|
I found this in a file of my directory where i compile the source code using kDevelop.
PHP Code:
|
looks like kDevelop uses automake. probably it would be a good idea to continue using that.
anyway, are you including GameEngine.h like #include <GameEngine.h> or like #include "GameEngine.h" ? It should be done the second way. I'm not entirely sure if that would cause the problem but it might. |
I use #include "GameEngine.h"
|
I dunno what to tell you except that the compiler doesn't see a GameEngine.h in that directory :(
|
I wanted to put my GameEngine.h in my GameEngine.cpp and then i saw that i had used <'s instead of "s.
Thank you for your help. Hylke EDIT: I have another question: I want to use texturing but then i need to add the glaux library.But how do i add the glaux library? thanx again. Hylke |
I'm going to guess that you give -lglaux on the gcc line, and #include some header to use it, perhaps glaux.h. Not having glaux, I can't really know :)
|
All times are GMT -5. The time now is 03:52 PM. |