The headers go in your Dev include folder (C:\dev-cpp\include for me), the libraries go in the lib folder, and the dll goes in the bin directory or the windows\system32 directory. A header is a table of contents listing function names, inputs and outputs, the libraries (.a and .dll files) have the real code. Here is the program:
It looks like you have not linked a correct library, but I can't really tell, as you did not post the information you were asked to post. Note that in the first post on this thread, I asked the following:
"Give that a try. Make sure that, if you have a problem, you post the basic information (you should always post)
(1) What version of Dev you are using with what OS?
(2) The code you are trying to compile.
(3) Your full compile log."
In this case, (1) and (3) are critical. Please post the FULL log, not just the errors. Its on the tab labeled "Compile Log". The right mouse button brings up the copy menu.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
yea!
I'm sorry the discussion "openGL problems..." is also from me and about the same problem and I'm sorry for the missing info:
(1) 4.9.8.7 and Win2k
(2) the code's are for example the two in the postings before and a lot of other code snipplets I tried; the error's are always the same...
(3) voil:
Compiler: Default compiler
Building Makefile: "C:\Documents and Settings\ursin\Desktop\openGL_devC\Normfarbwrfel\Makefile.win"
Fhrt make... aus
make.exe -f "C:\Documents and Settings\ursin\Desktop\openGL_devC\Normfarbwrfel\Makefile.win" all
g++.exe main.o -o "Normfarbcube.exe" -L"C:/Dev-Cpp/lib" -mwindows -lopengl32 -lglut32 -lglu32
main.o(.text+0x15):main.cpp: undefined reference to `__glutInitWithExit@12'
main.o(.text+0x32):main.cpp: undefined reference to `__glutCreateWindowWithExit@8'
main.o(.text+0x50):main.cpp: undefined reference to `__glutCreateMenuWithExit@8'
make.exe: *** [Normfarbcube.exe] Error 1
Ausfhrung beendet
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"C:\Documents and Settings\ursin\Desktop\openGL_devC\Normfarbwrfel\main.cpp"
May I suggest something like c:\mycstuff as a working directory?
Now, could you describe to me what you installed where for GLUT, and where you got it. Where for example did you put your libraries, headers and, importantly, your dll files. Be thorough and tell me exactly what you did please. I have a thought (I know THAT is hard to believe), but I need more data.
:-)
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
yea baby! I have to thank you! I was thinking I have to go mad until I could fix that openGL thing!!
THANK YOU FOR YOU HELP!
my working dir is going to make you mad? ;)
alora:
(1) I don't know where I got this GLUT, but I found it while PYTHON coding... ;) the readme says:
"This is GLUT for Win32 version 3.7.6 as of Nov 8th 2001."
(2) a search for "glut32.dll" has following result:
"glut32.dll in C:\WINNT\system
glut32.dll in C:\WINNT\system32"
(3) "glut.h" is in "C:\Dev-Cpp\include\GL"
(4) "glut32.lib" is in "C:\Dev-Cpp\lib"
I believe you everything!!! You know a lot more about this system!!! thats very good... (espacialy for me ;)
I hope I gave you enought data to verify your thought?!
(wish you nice easter - will be back on discussion on tuesday...)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thought I might point out to anyone who is wondering why their standard glut programs aren't linking that under windows you do need to include window.h, even though you might not use it.
so something like:
#ifdef __WIN32
#include <windows.h>
#endif
should do the trick...
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
[Linker error] undefined reference to `__glutInitWithExit@12'
[Linker error] undefined reference to `__glutCreateWindowWithExit@8'
[Linker error] undefined reference to `__glutCreateMenuWithExit@8'
[Build Error] [Project1.exe] Error 1
compiler logg:
Compiler: Default compiler
Building Makefile: "C:\Documents and Settings\Stefan\Skrivbord\sourceforge\Makefile.win"
Executing make clean
rm -f sourceforgetest.o Project1.exe
g++.exe -c sourceforgetest.cpp -o sourceforgetest.o -I"C:/Dev-Cpp/include/c++" -I"C:/Dev-Cpp/include/c++/mingw32" -I"C:/Dev-Cpp/include/c++/backward" -I"C:/Dev-Cpp/include"
g++.exe sourceforgetest.o -o "Project1.exe" -L"C:/Dev-Cpp/lib" -lopengl32 -lglut32 -lglu32 -mwindows
sourceforgetest.o(.text+0x17):sourceforgetest.cpp: undefined reference to `__glutInitWithExit@12'
sourceforgetest.o(.text+0x37):sourceforgetest.cpp: undefined reference to `__glutCreateWindowWithExit@8'
sourceforgetest.o(.text+0x5b):sourceforgetest.cpp: undefined reference to `__glutCreateMenuWithExit@8'
make.exe: *** [Project1.exe] Error 1
Execution terminated
glut32.dll in C:\Dev-Cpp\bin
glut32.dll in C:\WINDOWS\system
glut32.dll in C:\WINDOWS\system32
glut32.dll in C:\Dev-Cpp\bin
glut.lib in C:\Dev-Cpp\lib
glut32.lib in C:\Dev-Cpp\lib
libglut.a in C:\Dev-Cpp\lib
libglut32.a in C:\Dev-Cpp\lib
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"glut32.dll in C:\Dev-Cpp\bin
glut32.dll in C:\WINDOWS\system
glut32.dll in C:\WINDOWS\system32
glut32.dll in C:\Dev-Cpp\bin
glut.lib in C:\Dev-Cpp\lib
glut32.lib in C:\Dev-Cpp\lib
libglut.a in C:\Dev-Cpp\lib
libglut32.a in C:\Dev-Cpp\lib "
Where are the headers?
Did you delete the previous version of GLUT and get the one I told you to get?
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I believe i got them from the link http://mywebpage.netscape.com/PtrPck/glut.htm
at least I know that I downloaded the glut library from that site a while a go, But in my struggle to get this glut thing to work I've been dowloading glut lib from several places, maybe i better uninstall both devc++ and glut files and start all over again.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So, I uninstalled dev c++, deleted the ini and the cfg files. Downloaded the glut lib from http://mywebpage.netscape.com/PtrPck/glut.htm
and dev c++ 4.9.8.0
Put the files in the sugested directories and tried to compile the first of the two programs above.
heres my compile log:
Compiler: Default compiler
Building Makefile: "C:\ProgsStefan\opengl\sourceforgeexempel\Makefile.win"
Executing make clean
rm -f main.o Project1.exe
main.o(.text+0x15):main.cpp: undefined reference to `__glutInitWithExit@12'
main.o(.text+0x32):main.cpp: undefined reference to `__glutCreateWindowWithExit@8'
main.o(.text+0x50):main.cpp: undefined reference to `__glutCreateMenuWithExit@8'
main.o(.text+0x192):main.cpp: undefined reference to `glutInitDisplayMode@4'
main.o(.text+0x1a7):main.cpp: undefined reference to `glutInitWindowSize@8'
main.o(.text+0x1b6):main.cpp: undefined reference to `glutInitWindowPosition@8'
main.o(.text+0x1db):main.cpp: undefined reference to `glutDisplayFunc@4'
main.o(.text+0x1e3):main.cpp: undefined reference to `glutMainLoop@0'
make.exe: *** [Project1.exe] Error 1
Execution terminated
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Using Open Gl to make Red Triangles. Code onpp49-56 of Open Gl Game Programming by LaMothe.
The compiler shows no errors, but cant execute. Log says "g++:argument to "-l" missing.
What does this mean?
Bob Hard
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Here is a simple example program that uses Glut to draw a box. Glut - the headers, libraries and libraries can found here:
http://mywebpage.netscape.com/PtrPck/glut.htm
The headers go in your Dev include folder (C:\dev-cpp\include for me), the libraries go in the lib folder, and the dll goes in the bin directory or the windows\system32 directory. A header is a table of contents listing function names, inputs and outputs, the libraries (.a and .dll files) have the real code. Here is the program:
#include <windows.h>
#include <gl/glut.h>
#include <stdlib.h>
void display(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, 1.0,1.0);
glBegin(GL_POLYGON);
glVertex3f(0.25, 0.25, 0.0);
glVertex3f(0.75, 0.25, 0.0);
glVertex3f(0.75, 0.75, 0.0);
glVertex3f(0.25, 0.75, 0.0);
glEnd();
glFlush();
}
void init(void)
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(250, 250);
glutInitWindowPosition(100, 100);
glutCreateWindow("hello");
init();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
Compiling this as a simple file, I went to Tools:Compiler Options:Compiler:Add these Commands To The Linker Command Line
-lglut32 -lopengl32
And I go a compile log that looks like this:
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\mycstuff\glutter.cpp" -o "C:\mycstuff\glutter.exe" -I"C:\Dev-Cpp\include\c++" -I"C:\Dev-Cpp\include\c++\mingw32" -I"C:\Dev-Cpp\include\c++\backward" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -lglut32 -lopengl32
Execution terminated
Compilation successful
Give that a try. Make sure that, if you have a problem, you post the basic information (you should always post)
(1) What version of Dev you are using with what OS?
(2) The code you are trying to compile.
(3) Your full compile log.
OpenGL GEM from Light Knight:
Cut and paste this into an empty project.
In project options, set Type to Win321 GUI and add -lopengl32 -lglut32 -lglu32 to the linker options
You'll also need 'glut32.dll' in your directory or the WINDOWS/SYSTEM32/ dir.
Glut is a less painful intro to opengl
------------------
#include <windows.h>
#include <GL/glut.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define _PI 3.14159
#define _2PI 2 * _PI
#define X 0
#define Y 1
#define Z 2
#define LON 0
#define LAT 1
#define DIS 2
#define RED 0
#define BLU 1
#define GRE 2
//camera
float fLookAtEyeR[3] = {0.0,0.0,0.0},
fLookAtEyeP[3] = {_PI,-1.222,5.0}, // start pos (should't use magic numbers though)
fLookAtCen[3] = {0.0,0.0,0.0},
fLookAtUp[3] = {0.0,-1.0,0.0};
//mouse - view interface
int iMoving,
iStartX,
iStartY,
iAuto = 0;
// Sample
#define RING_SEGS 20
#define RING_DIAM 3.0
float fRingV[RING_SEGS][3],
fRingC[RING_SEGS][3];
int fRingI[RING_SEGS];
float fRingAng = 0.0;
void MakeRing()
{
float fAng=0,
fAngStep,
fCRef, //color ref
fCSeg = _2PI/3; //color segments
fAngStep = _2PI / RING_SEGS;
for(int iCnt=0;iCnt<RING_SEGS;iCnt++,fAng+=fAngStep){
fRingI[iCnt] = iCnt;
// simple trig
fRingV[iCnt][X] = 0.0;
fRingV[iCnt][Y] = sin(fAng) * (RING_DIAM/2);
fRingV[iCnt][Z] = cos(fAng) * (RING_DIAM/2);
// make it pretty
if(fAng > fCSeg * 2){ // from blue to green
fCRef = fAng - (fCSeg*2);
fRingC[iCnt][RED] = 1.0;
fRingC[iCnt][BLU] = 1.0-fCRef / fCSeg;
fRingC[iCnt][GRE] = fCRef / fCSeg;
}
else if(fAng > fCSeg){ // from green to red
fCRef = fAng - fCSeg;
fRingC[iCnt][RED] = fCRef / fCSeg;
fRingC[iCnt][BLU] = 1.0;
fRingC[iCnt][GRE] = 1.0-fCRef / fCSeg;
}
else{
fCRef = fAng; // from red to blue
fRingC[iCnt][RED] = 1.0-fCRef / fCSeg;
fRingC[iCnt][BLU] = fCRef / fCSeg;
fRingC[iCnt][GRE] = 1.0;
}
}
}
void Ring()
{
glPushMatrix();
glTranslatef(0.0,-(RING_DIAM/2),0.0);
glRotatef(fRingAng,0.0,1.0,0.0);
glBegin(GL_LINE_LOOP);
for(int iCnt=0;iCnt<RING_SEGS;iCnt++){
glColor3f(fRingC[iCnt][RED],fRingC[iCnt][BLU],fRingC[iCnt][GRE]);
glVertex3f(fRingV[iCnt][X],fRingV[iCnt][Y],fRingV[iCnt][Z]);
}
glEnd();
glPopMatrix();
}
void P2RView() // polar to rectangular co-ords
{
float fT;
fLookAtEyeR[Y] = sin(fLookAtEyeP[LAT])*fLookAtEyeP[DIS];
fT = cos(fLookAtEyeP[LAT])*fLookAtEyeP[DIS];
fLookAtEyeR[X] = sin(fLookAtEyeP[LON])*fT;
fLookAtEyeR[Z] = cos(fLookAtEyeP[LON])*fT;
}
void DrawFloor(void)
{
float fCnt;
glBegin(GL_LINES);
glColor3f(1.0,0.0,1.0);
glVertex3f(-10.0,0.0,-10.0); //Bold line
glVertex3f(-10.0,0.0,10.0);
glColor3f(0.5,0.0,0.5);
for(fCnt = -9.0;fCnt <= 10.0;fCnt++){
glVertex3f(fCnt,0.0,-10.0);
glVertex3f(fCnt,0.0,10.0);
}
glBegin(GL_LINES);
glColor3f(1.0,0.0,1.0);
glVertex3f(-10.0,0.0,-10.0); //Bold line
glVertex3f(10.0,0.0,-10.0);
glColor3f(0.5,0.0,0.5);
for(fCnt = -9.0;fCnt <= 10.0;fCnt++){
glVertex3f(-10.0,0.0,fCnt);
glVertex3f(10.0,0.0,fCnt);
}
glEnd();
}
void Init(void)
{
glEnable(GL_DEPTH_TEST);
glClearColor (0.0,0.0,0.0,0.0);
MakeRing(); //or your stuff
}
void Display(void)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glPushMatrix();
P2RView();
gluLookAt(fLookAtEyeR[X],fLookAtEyeR[Y],fLookAtEyeR[Z],
fLookAtCen[X],fLookAtCen[Y],fLookAtCen[Z],
fLookAtUp[X],fLookAtUp[Y],fLookAtUp[Z]);
DrawFloor();
//Your objects go here - eg. Ring().
Ring();
// restore matrix and update display
glPopMatrix();
glutSwapBuffers();
}
void Reshape(int iW,int iH)
{
glViewport(0,0,iW,iH);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
if(iH == 0)
gluPerspective(80,(float)iW,1.0,5000.0);
else
gluPerspective(80,(float)iW/(float)iH,1.0,5000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
}
#pragma argsused
void Keyboard(unsigned char cKey,int iX,int iY)
{
switch(cKey){
case 27: /* Escape key */
exit(0);
break;
case 'f':
glutFullScreen();
break;
case 'w':
glutReshapeWindow(300,300);
break;
case 'a':
iAuto = (iAuto == 1) ? 0 : 1;
break;
default:
break;
}
}
void Mouse(int iButton,int iState,int iX,int iY)
{
if(iButton == GLUT_LEFT_BUTTON && iState == GLUT_DOWN)
{
iMoving = GLUT_LEFT_BUTTON;
iStartX = iX;
iStartY = iY;
}
if(iButton == GLUT_RIGHT_BUTTON && iState == GLUT_DOWN){
iMoving = GLUT_RIGHT_BUTTON;
iStartX = iX;
iStartY = iY;
}
if((iButton == GLUT_LEFT_BUTTON || iButton == GLUT_RIGHT_BUTTON) && iState == GLUT_UP)
iMoving = 0;
}
void Motion(int iX,int iY)
{
float fTemp;
if(iMoving == GLUT_LEFT_BUTTON) {
fTemp = (float)( iX - iStartX ) / 200.0;
if(fTemp>_2PI)fTemp-=_2PI;
fLookAtEyeP[LON] = fLookAtEyeP[LON] + fTemp;
fTemp = (float) ( iY - iStartY ) / 200.0;
if(fLookAtEyeP[LAT]>_PI/2.0)fLookAtEyeP[LAT]=_PI/2.0;
fLookAtEyeP[LAT] = fLookAtEyeP[LAT] + fTemp;
iStartX = iX;
iStartY = iY;
glutPostRedisplay ( );
}
if(iMoving == GLUT_RIGHT_BUTTON)
{
fLookAtEyeP[DIS] = fLookAtEyeP[DIS] + (float)(iY - iStartY) / 10;
iStartY = iY;
glutPostRedisplay();
}
}
void Idlef(void)
{
static float fCyc1,fCyc2;
if(iAuto){
fCyc1 += 0.014f; // adjust as required by system,
if(fCyc1 > _2PI) fCyc1 -= _2PI; // Better sill, adjust by time.
fCyc2 += .021f; // <-this too.
if(fCyc2 > _2PI) fCyc2 -= _2PI;
fLookAtEyeP[LON] += 0.01f;
fLookAtEyeP[LAT] = sin(fCyc1) * (_PI/4.0f);
fLookAtEyeP[DIS] = 5.0f + sin(fCyc2) * 2.0f;
}
fRingAng += 1.0;
glutPostRedisplay();
}
int main(int iArgc,char** szpArgv)
{
glutInit(&iArgc,szpArgv);
glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE );
glutInitWindowSize (600, 400);
glutCreateWindow (szpArgv[0]);
Init();
glutReshapeFunc (Reshape);
glutKeyboardFunc (Keyboard);
glutMouseFunc (Mouse);
glutMotionFunc (Motion);
glutDisplayFunc (Display);
glutIdleFunc (Idlef);
glutMainLoop ();
return 0;
}
-----------
Light Knight
p.s. Click and drag with L/R button to change view. press 'a' for auto.
...if i try to compile this example with your options I got following errors:
[Linker error] undefined reference to `__glutInitWithExit@12'
[Linker error] undefined reference to `__glutCreateWindowWithExit@8'
[Linker error] undefined reference to `__glutCreateMenuWithExit@8'
C:\Documents and Settings\ursin\Desktop\openGL_devC\Normfarbwrfel\Makefile.win
[Build Error] [Normfarbcube.exe] Error 1
WHAT AM I DOING WRONG ???? please help me!! ;))
THANKS
...if i try to compile this example with your options I got following errors:
[Linker error] undefined reference to `__glutInitWithExit@12'
[Linker error] undefined reference to `__glutCreateWindowWithExit@8'
[Linker error] undefined reference to `__glutCreateMenuWithExit@8'
C:\Documents and Settings\ursin\Desktop\openGL_devC\Normfarbwrfel\Makefile.win
[Build Error] [Normfarbcube.exe] Error 1
WHAT AM I DOING WRONG ???? please help me!! ;))
THANKS
It looks like you have not linked a correct library, but I can't really tell, as you did not post the information you were asked to post. Note that in the first post on this thread, I asked the following:
"Give that a try. Make sure that, if you have a problem, you post the basic information (you should always post)
(1) What version of Dev you are using with what OS?
(2) The code you are trying to compile.
(3) Your full compile log."
In this case, (1) and (3) are critical. Please post the FULL log, not just the errors. Its on the tab labeled "Compile Log". The right mouse button brings up the copy menu.
Wayne
yea!
I'm sorry the discussion "openGL problems..." is also from me and about the same problem and I'm sorry for the missing info:
(1) 4.9.8.7 and Win2k
(2) the code's are for example the two in the postings before and a lot of other code snipplets I tried; the error's are always the same...
(3) voil:
Compiler: Default compiler
Building Makefile: "C:\Documents and Settings\ursin\Desktop\openGL_devC\Normfarbwrfel\Makefile.win"
Fhrt make... aus
make.exe -f "C:\Documents and Settings\ursin\Desktop\openGL_devC\Normfarbwrfel\Makefile.win" all
g++.exe main.o -o "Normfarbcube.exe" -L"C:/Dev-Cpp/lib" -mwindows -lopengl32 -lglut32 -lglu32
main.o(.text+0x15):main.cpp: undefined reference to `__glutInitWithExit@12'
main.o(.text+0x32):main.cpp: undefined reference to `__glutCreateWindowWithExit@8'
main.o(.text+0x50):main.cpp: undefined reference to `__glutCreateMenuWithExit@8'
make.exe: *** [Normfarbcube.exe] Error 1
Ausfhrung beendet
OK, now try the first example as written, NOT as a project, and linking *only* the libraries I tell you to *in the order* I tell you to.
Also, please note, SPACES IN PATHS ARE BAD, do not put your project in directories like this:
C:\Documents and Settings\ursin\Desktop\openGL_devC\Normfarbwrfel\Makefile.win
This is not your problem here, but it will bite you at some point.
Wayne
yea, that problem with the paths I already had, it's also a problem with UNC path, isn't it?
so I did what you wrote (without understanding why... ;) but I have to say, I won't work either...
here the new log (i switched to english):
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Documents and Settings\ursin\Desktop\openGL_devC\Normfarbwrfel\main.cpp" -o "C:\Documents and Settings\ursin\Desktop\openGL_devC\Normfarbwrfel\main.exe" -I"C:\Dev-Cpp\include\c++" -I"C:\Dev-Cpp\include\c++\mingw32" -I"C:\Dev-Cpp\include\c++\backward" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -lglut32 -lopengl32
C:\DOCUME~1\ursin\LOCALS~1\Temp/ccURaaaa.o(.text+0x15):main.cpp: undefined reference to `__glutInitWithExit@12'
C:\DOCUME~1\ursin\LOCALS~1\Temp/ccURaaaa.o(.text+0x32):main.cpp: undefined reference to `__glutCreateWindowWithExit@8'
C:\DOCUME~1\ursin\LOCALS~1\Temp/ccURaaaa.o(.text+0x50):main.cpp: undefined reference to `__glutCreateMenuWithExit@8'
Execution terminated
"C:\Documents and Settings\ursin\Desktop\openGL_devC\Normfarbwrfel\main.cpp"
May I suggest something like c:\mycstuff as a working directory?
Now, could you describe to me what you installed where for GLUT, and where you got it. Where for example did you put your libraries, headers and, importantly, your dll files. Be thorough and tell me exactly what you did please. I have a thought (I know THAT is hard to believe), but I need more data.
:-)
Wayne
yea baby! I have to thank you! I was thinking I have to go mad until I could fix that openGL thing!!
THANK YOU FOR YOU HELP!
my working dir is going to make you mad? ;)
alora:
(1) I don't know where I got this GLUT, but I found it while PYTHON coding... ;) the readme says:
"This is GLUT for Win32 version 3.7.6 as of Nov 8th 2001."
(2) a search for "glut32.dll" has following result:
"glut32.dll in C:\WINNT\system
glut32.dll in C:\WINNT\system32"
(3) "glut.h" is in "C:\Dev-Cpp\include\GL"
(4) "glut32.lib" is in "C:\Dev-Cpp\lib"
I believe you everything!!! You know a lot more about this system!!! thats very good... (espacialy for me ;)
I hope I gave you enought data to verify your thought?!
(wish you nice easter - will be back on discussion on tuesday...)
I recommend you follow the steps outlined in my first post on this thread to download a version of GLUT for MinGW.
Wayne
Thought I might point out to anyone who is wondering why their standard glut programs aren't linking that under windows you do need to include window.h, even though you might not use it.
so something like:
#ifdef __WIN32
#include <windows.h>
#endif
should do the trick...
ack....i got the same error.....you must put the glut stuff where wayne says ya gotta......or you get linker errors........
Think I've tried everything, but still failure:
Win XP
Dev C++ 4.9.8.7
[Linker error] undefined reference to `__glutInitWithExit@12'
[Linker error] undefined reference to `__glutCreateWindowWithExit@8'
[Linker error] undefined reference to `__glutCreateMenuWithExit@8'
[Build Error] [Project1.exe] Error 1
compiler logg:
Compiler: Default compiler
Building Makefile: "C:\Documents and Settings\Stefan\Skrivbord\sourceforge\Makefile.win"
Executing make clean
rm -f sourceforgetest.o Project1.exe
g++.exe -c sourceforgetest.cpp -o sourceforgetest.o -I"C:/Dev-Cpp/include/c++" -I"C:/Dev-Cpp/include/c++/mingw32" -I"C:/Dev-Cpp/include/c++/backward" -I"C:/Dev-Cpp/include"
g++.exe sourceforgetest.o -o "Project1.exe" -L"C:/Dev-Cpp/lib" -lopengl32 -lglut32 -lglu32 -mwindows
sourceforgetest.o(.text+0x17):sourceforgetest.cpp: undefined reference to `__glutInitWithExit@12'
sourceforgetest.o(.text+0x37):sourceforgetest.cpp: undefined reference to `__glutCreateWindowWithExit@8'
sourceforgetest.o(.text+0x5b):sourceforgetest.cpp: undefined reference to `__glutCreateMenuWithExit@8'
make.exe: *** [Project1.exe] Error 1
Execution terminated
glut32.dll in C:\Dev-Cpp\bin
glut32.dll in C:\WINDOWS\system
glut32.dll in C:\WINDOWS\system32
glut32.dll in C:\Dev-Cpp\bin
glut.lib in C:\Dev-Cpp\lib
glut32.lib in C:\Dev-Cpp\lib
libglut.a in C:\Dev-Cpp\lib
libglut32.a in C:\Dev-Cpp\lib
"glut32.dll in C:\Dev-Cpp\bin
glut32.dll in C:\WINDOWS\system
glut32.dll in C:\WINDOWS\system32
glut32.dll in C:\Dev-Cpp\bin
glut.lib in C:\Dev-Cpp\lib
glut32.lib in C:\Dev-Cpp\lib
libglut.a in C:\Dev-Cpp\lib
libglut32.a in C:\Dev-Cpp\lib "
Where are the headers?
Did you delete the previous version of GLUT and get the one I told you to get?
Wayne
And you went back to that project. Why did you do that? You went back to linking different libraries too. Please follow the directions.
Wayne
The headers are in C:\Dev-Cpp\include\gl
They are:
gl.h
glaux.h
glext.h
glu.h
glut.h
I uninstalled my old dev c++, also deleted the dev files mentioned.
and installed the new version -
Where did the Glut files come from?
Wayne
I believe i got them from the link http://mywebpage.netscape.com/PtrPck/glut.htm
at least I know that I downloaded the glut library from that site a while a go, But in my struggle to get this glut thing to work I've been dowloading glut lib from several places, maybe i better uninstall both devc++ and glut files and start all over again.
So, I uninstalled dev c++, deleted the ini and the cfg files. Downloaded the glut lib from http://mywebpage.netscape.com/PtrPck/glut.htm
and dev c++ 4.9.8.0
Put the files in the sugested directories and tried to compile the first of the two programs above.
heres my compile log:
Compiler: Default compiler
Building Makefile: "C:\ProgsStefan\opengl\sourceforgeexempel\Makefile.win"
Executing make clean
rm -f main.o Project1.exe
g++.exe -c main.cpp -o main.o -I"C:/Dev-Cpp/include/c++" -I"C:/Dev-Cpp/include/c++/mingw32" -I"C:/Dev-Cpp/include/c++/backward" -I"C:/Dev-Cpp/include"
g++.exe main.o -o "Project1.exe" -L"C:/Dev-Cpp/lib" -mwindows -lopengl32
main.o(.text+0x15):main.cpp: undefined reference to `__glutInitWithExit@12'
main.o(.text+0x32):main.cpp: undefined reference to `__glutCreateWindowWithExit@8'
main.o(.text+0x50):main.cpp: undefined reference to `__glutCreateMenuWithExit@8'
main.o(.text+0x192):main.cpp: undefined reference to `glutInitDisplayMode@4'
main.o(.text+0x1a7):main.cpp: undefined reference to `glutInitWindowSize@8'
main.o(.text+0x1b6):main.cpp: undefined reference to `glutInitWindowPosition@8'
main.o(.text+0x1db):main.cpp: undefined reference to `glutDisplayFunc@4'
main.o(.text+0x1e3):main.cpp: undefined reference to `glutMainLoop@0'
make.exe: *** [Project1.exe] Error 1
Execution terminated
So, I uninstalled dev c++, deleted the ini and the cfg files. Downloaded ........
Hey, Suddenly It Works!!!
How happy could one man be...
Thank you, thank you Dr Wayne
...back from easter!!!
yea - this thread was going on..... ;)
I also tried this one with the MingW-GLUT! It works! Thank you very mouch DR!! :)
Using Open Gl to make Red Triangles. Code onpp49-56 of Open Gl Game Programming by LaMothe.
The compiler shows no errors, but cant execute. Log says "g++:argument to "-l" missing.
What does this mean?
Bob Hard
Bobo,
Posting your full compile log (its on the tab labeled Compile Log, the right mouse button brings up the copy meny) would be helpful.
Also, please tell me exactly what version of Dev you are using.
Thanks,
Wayne
Bob,
I apologize for my typo...attention to detail is important in programming and I sure did not show it with that post...
Wayne