Errors in Dev-C++
Author |
Message |
tupac
![](http://compsci.ca/v3/uploads/user_avatars/4505289784b82e037a6d87.jpg)
|
Posted: Sat Oct 28, 2006 8:59 pm Post subject: Errors in Dev-C++ |
|
|
I used to use MSVC++ to do some OpenGL work, but switched to Dev-C++ because you can get it for free, and since i use all different computers i can't keep installing MSVC++ everywhere. so i started using Dev-C++, and i realized that it was very different than using visual c++. i made some code, and tried to run it, but got 4 errors (in MSVC++ this code would compile no prob.). the code is here (this code is to make a basic openGL window):
code: |
#include <windows.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include <GL/glut.h>
void disp(void){
glClearColor(0.0,0.0,0.0,1.0);
glClear(GL_COLOR_BUFFER_BIT);
glLoadIdentity();
gluLookAt(0.0,0.0,5.0,0.0,0.0,0.0,0.0,1.0,0.0);
glutSwapBuffers();
glFlush();
}
void reshape(int w, int h){
glViewport(0,0,(GLsizei)w,(GLsizei)h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60,(GLsizei)w/(GLsizei)h,1.0,100.0);
glMatrixMode(GL_MODELVIEW);
}
int main(int argc, char** argv){
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_DOUBLE);
glutInitWindowSize(500,500);
glutInitWindowPosition(0,0);
glutCreateWindow("ogl win");
glutDisplayFunc(disp);
glutIdleFunc(disp);
glutReshapeFunc(reshape);
glutMainLoop();
return 0;
}
|
and i get errors saying:
code: |
Untitled2.o(.text+0x1c):Untitled2.cpp: undefined reference to `__glutInitWithExit@12'
Untitled2.o(.text+0x3d):Untitled2.cpp: undefined reference to `__glutCreateWindowWithExit@8'
Untitled2.o(.text+0x5d):Untitled2.cpp: undefined reference to `__glutCreateMenuWithExit@8'
collect2: ld returned 1 exit status
make.exe: *** [Project1.exe] Error 1
Execution terminated
|
does anyone know what's wrong? cuz i've been trying to find out, and it's just been a living hell.
thnx in advance |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
md
![](http://compsci.ca/v3/uploads/user_avatars/1849317514ed6c4399768d.png)
|
Posted: Sat Oct 28, 2006 10:50 pm Post subject: (No subject) |
|
|
It's a linkter error, from the looks of it not all teh glut functions are being linked. Did you add the glut to your linker line? Since your using Dev-C++ I dunnot how to do this, but using make files it's pretty easy. |
|
|
|
|
![](images/spacer.gif) |
r.3volved
|
Posted: Sat Oct 28, 2006 11:49 pm Post subject: (No subject) |
|
|
The MSVC++ compiler is free to download and use from Microsoft.
You can set up Dev-C++ to use the VC++ compiler if you want, or simply compile via command line.
It's pretty much the Visual Studio IDE that requires payment, not necessarily all the compilers. |
|
|
|
|
![](images/spacer.gif) |
tupac
![](http://compsci.ca/v3/uploads/user_avatars/4505289784b82e037a6d87.jpg)
|
Posted: Sun Oct 29, 2006 2:18 pm Post subject: (No subject) |
|
|
wow, i didnt know that i could use MSVC++ compiler in Dev-C++. well, im gonna try it out l8er cuz i dont have dev here @ the moment, but ill put an update if it worked or not.
thnx for all the help |
|
|
|
|
![](images/spacer.gif) |
r.3volved
|
Posted: Sun Oct 29, 2006 2:21 pm Post subject: (No subject) |
|
|
I'm pretty sure you can link the IDE to different compilers...
If nothing else, there's always the command line option if you want that specific compiler |
|
|
|
|
![](images/spacer.gif) |
wtd
|
Posted: Sun Oct 29, 2006 2:21 pm Post subject: (No subject) |
|
|
The compiler you use should not help much, if it's a link error. |
|
|
|
|
![](images/spacer.gif) |
[Gandalf]
![](http://compsci.ca/v3/uploads/user_avatars/189297994e4c716fec7f1.png)
|
Posted: Sun Oct 29, 2006 8:55 pm Post subject: (No subject) |
|
|
Alright, now that I'm on the computer with Dev-C++...
To fix the linker error, go to: Project -> Project Options -> Parameters -> Linker and add the appropriate linker options there. |
|
|
|
|
![](images/spacer.gif) |
tupac
![](http://compsci.ca/v3/uploads/user_avatars/4505289784b82e037a6d87.jpg)
|
Posted: Mon Oct 30, 2006 3:11 pm Post subject: (No subject) |
|
|
ya, so i figured it out, all i had 2 do was just download a "glut" kit, and just intall it. the kit out all the stuff that i need to program glut, so now i just open my Dev-c++, choose file>new>project>multimedia>glut, and after doing that, i can just write the same code as i would in MSVC++
well, thnx a lot for all ure relpies |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
|
|