what does this error mean?!?! I cant understand it.
Im using the gl.h, glu.h and windows headers and im trying to replicate the simple rotating triangle thing but I get about 25 of these errors when i try to compile. Infact i htink i get it for every single glXxxx function
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Ok...so i deserved to be snarflled or whatever it was...
Using Dev-C++ version 4.9.8.0
I'm not sure i could show you a simpler program than the one I'm having problesm with - so I'll copy all the code in making this post probably very very long. I'm working through a book...so i lack the know how to simplify it and replicate the error.
include <windows.h>
include <gl/gl.h>
include <gl/glu.h>
//Global Variables
float angle = 0.0f; //Current angle of triangle
HDC g_HDC; //global device ocntext
char szClassName[ ] = "WindowsApp"; // Make the class name into a global variable
//Funciton to set the pixel format
void SetupPixelFormat(HDC hDC)
{
int nPixelFormat; //Pixel format index
static PIXELFORMATDESCRIPTOR pfd = {
sizeof(PIXELFORMATDESCRIPTOR), //Size of structure
1, //version, always set to 1
PFD_DRAW_TO_WINDOW | //Support window
PFD_SUPPORT_OPENGL | //support opengl
PFD_DOUBLEBUFFER, //support double buffering
PFD_TYPE_RGBA, //RGBA color mode
32, //32 bit color mode
0, 0, 0, 0, 0, 0, //ignore color bits - not used
0, //No alpha buffer
0, //ignor shift bit
0, //no accumulation buffer
0, 0, 0, 0, //ignore accumulation bits
16, //16bit z-buffer size
0, //No stencil buffer
0, //no auxilery plane
PFD_MAIN_PLANE, //main drawing plane
0, //reserved
0, 0, 0 }; //layer masks ignored
//choose best match
nPixelFormat = ChoosePixelFormat(hDC, &pfd);
//set pixel format
SetPixelFormat(hDC, nPixelFormat, &pfd);
int WINAPI WinMain (HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
HWND hwnd; / This is the handle for our window /
MSG messages; / Here messages to the application are saved /
WNDCLASSEX wincl; / Data structure for the windowclass /
bool done;
/* The Window structure */
wincl.hInstance=hInstance;
wincl.lpszClassName=szClassName;
wincl.lpfnWndProc=WindowProcedure;/* This function is called by windows */
wincl.style=CS_DBLCLKS;/* Catch double-clicks */
wincl.cbSize=sizeof(WNDCLASSEX);/* Use default icon and mouse-pointer */
wincl.hIcon=LoadIcon(NULL,IDI_APPLICATION);
wincl.hIconSm=LoadIcon(NULL,IDI_APPLICATION);
wincl.hCursor=LoadCursor(NULL,IDC_ARROW);
wincl.lpszMenuName=NULL;/* No menu */
wincl.cbClsExtra=0;/* No extra bytes after the window class */
wincl.cbWndExtra=0;/* structure or the window instance *//* Use Windows's default color as the background of the window */
wincl.hbrBackground=(HBRUSH)COLOR_BACKGROUND;/* Register the window class, and if it fails quit the program */if(!RegisterClassEx(&wincl))return0;/* The class is registered, let's create the program*/
hwnd=CreateWindowEx(0,/* Extended possibilites for variation */szClassName,/* Classname */"WindowsApplication",/* Title Text */WS_OVERLAPPEDWINDOW,/* default window */CW_USEDEFAULT,/* Windows decides the position */CW_USEDEFAULT,/* where the window ends up on the screen */544,/* The programs width */375,/* and height in pixels */HWND_DESKTOP,/* The window is a child-window to desktop */NULL,/* No menu */hInstance,/* Program Instance handler */NULL/* No Window Creation data */);/* Make the window visible on the screen */
ShowWindow(hwnd,nFunsterStil);
UpdateWindow(hwnd);
done=false;while(!done){PeekMessage(&messages,hwnd,0,0,PM_REMOVE);//pendingmessage?if(messages.message==WM_QUIT){done=true;}else{//dorenderinghere
//clearscreenanddepthbuffer
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);glLoadIdentity();angle=angle+0.1f;//increaseyourangle
if(angle>=360.0f){angle=0.0f;}glTranslatef(0.0f,0.0f,-5.0f);glRotatef(angle,0.0f,0.0f,1.0f);glColor3f(1.0f,0.0f,0.0f);glBegin(GL_TRIANGLES);glVertex3f(0.0f,0.0f,0.0f);glVertex3f(1.0f,0.0f,0.0f);glVertex3f(1.0f,1.0f,0.0f);glEnd();SwapBuffers(g_HDC);TranslateMessage(&messages);//translatethemessage
DispatchMessage(&messages);//dispatchtowindows
}}/* The program return-value is 0 - The value that PostQuitMessage() gave */returnmessages.wParam;
}
/ This function is called by the Windows function DispatchMessage() /
First, I would upgrade to 4.9.9.2. Second, I would re-read the "post before reading" document because some of your issues are covered there. It's not just the basic three that I was looking for - the common problems that newcomers have are also discussed in that post.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Actually, had you read a little farther in that section, you would have seen a section on getting started with Glut, which covers your problem. Please check it out.
Short version - you failed to link any of the required libraries. There is also a section in that thread on including headers and linking libraries that you might find helpful.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
With respect to the snarfled comment, it is my gentle way (using a reference to a movie) of pointing out that you should take a moment or two and check around a forum BEFORE you post your question.
Not doing so makes more work for the complete strangers you are asking for free help.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
what does this error mean?!?! I cant understand it.
Im using the gl.h, glu.h and windows headers and im trying to replicate the simple rotating triangle thing but I get about 25 of these errors when i try to compile. Infact i htink i get it for every single glXxxx function
Please read the post titled "PLEASE READ BEFORE POSTING A QUESTION" before posting a question.
Ok...so i deserved to be snarflled or whatever it was...
Using Dev-C++ version 4.9.8.0
I'm not sure i could show you a simpler program than the one I'm having problesm with - so I'll copy all the code in making this post probably very very long. I'm working through a book...so i lack the know how to simplify it and replicate the error.
include <windows.h>
include <gl/gl.h>
include <gl/glu.h>
//Global Variables
float angle = 0.0f; //Current angle of triangle
HDC g_HDC; //global device ocntext
char szClassName[ ] = "WindowsApp"; // Make the class name into a global variable
//Funciton to set the pixel format
void SetupPixelFormat(HDC hDC)
{
int nPixelFormat; //Pixel format index
}
/ Declare Windows procedure /
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
int WINAPI WinMain (HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
HWND hwnd; / This is the handle for our window /
MSG messages; / Here messages to the application are saved /
WNDCLASSEX wincl; / Data structure for the windowclass /
bool done;
}
/ This function is called by the Windows function DispatchMessage() /
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
}
Compiler: Default compiler
Building Makefile: "C:\Dev-Cpp\Projects\WindowsTest2\Makefile.win"
Executing make...
make.exe -f "C:\Dev-Cpp\Projects\WindowsTest2\Makefile.win" all
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 "WinTest.exe" -L"C:/Dev-Cpp/lib" -mwindows
main.o(.text+0x186):main.cpp: undefined reference to
glClear@4' main.o(.text+0x18e):main.cpp: undefined reference to
glLoadIdentity@0'main.o(.text+0x1d6):main.cpp: undefined reference to
glTranslatef@12' main.o(.text+0x1ed):main.cpp: undefined reference to
glRotatef@16'main.o(.text+0x1fe):main.cpp: undefined reference to
glColor3f@12' main.o(.text+0x20b):main.cpp: undefined reference to
glBegin@4'main.o(.text+0x21c):main.cpp: undefined reference to
glVertex3f@12' main.o(.text+0x230):main.cpp: undefined reference to
glVertex3f@12'main.o(.text+0x247):main.cpp: undefined reference to
glVertex3f@12' main.o(.text+0x24f):main.cpp: undefined reference to
glEnd@0'main.o(.text+0x32c):main.cpp: undefined reference to
wglCreateContext@4' main.o(.text+0x348):main.cpp: undefined reference to
wglMakeCurrent@8'main.o(.text+0x367):main.cpp: undefined reference to
wglMakeCurrent@8' main.o(.text+0x378):main.cpp: undefined reference to
wglDeleteContext@4'main.o(.text+0x3c9):main.cpp: undefined reference to
glViewport@16' main.o(.text+0x3d6):main.cpp: undefined reference to
glMatrixMode@4'main.o(.text+0x3de):main.cpp: undefined reference to
glLoadIdentity@0' main.o(.text+0x407):main.cpp: undefined reference to
gluPerspective@32'main.o(.text+0x414):main.cpp: undefined reference to `glMatrixMode@4'
main.o(.text+0x41c):main.cpp: undefined reference to `glLoadIdentity@0'
make.exe: *** [WinTest.exe] Error 1
Execution terminated
First, I would upgrade to 4.9.9.2. Second, I would re-read the "post before reading" document because some of your issues are covered there. It's not just the basic three that I was looking for - the common problems that newcomers have are also discussed in that post.
Actually, had you read a little farther in that section, you would have seen a section on getting started with Glut, which covers your problem. Please check it out.
Short version - you failed to link any of the required libraries. There is also a section in that thread on including headers and linking libraries that you might find helpful.
Wayne
With respect to the snarfled comment, it is my gentle way (using a reference to a movie) of pointing out that you should take a moment or two and check around a forum BEFORE you post your question.
Not doing so makes more work for the complete strangers you are asking for free help.
Wayne
I've read teh FAQ - but i really dont get it, I tried going into Project->Project Options but i dunno what to put in the Linker box...
The getting started with Glut directions tell you what to put where - step by step. I suggest you follow the example there in the same way.
If you have a problem - post something like:
The directions say to put
-lglu32
in the xhyz menu.
Where is that menu?
Wayne
Read it more closely. Pay particular attention to the latter half of this line:
"In project options, set Type to Win321 GUI and add -lopengl32 -lglut32 -lglu32 to the linker options."
Note that the directions tell you what commands to put in, things like
-lglut32 -ldiewayne
ARE linker commands.
Sorted! Thanks for ur patience