devc++ prob
I''m tring to get nehe lesson 03 to work in dev c++ I have included "-lopengl32 -lglaux -lglu32" in the "extra compiler options" box but it keeps saying
"g++: -lopengl32: linker input file unused since linking not done
g++: -lglaux: linker input file unused since linking not done
g++: -lglu32: linker input file unused since linking not done"
when I compile. Anyone have any ideas? is there something I''m not doing?
have you included the correct headers? Those libraries wont really do anything unless you include their headers. For example, -lopengl32 needs #include <gl/gl.h> or whatever to work, at least in my experience.
Look at what it said
"BECAUSE LINKING NOT DONE"
That means you have bigger problem than linking, inside your source code, so the linking part was never done. Maybe you have the right linker options, but it never got to that point because there are errors in the code. You never got the .c or .cpp to compile to a .o, so how can it link the .o into a .EXE ?
Another thing is the order of linker switches, you need to put it like -lglaux -lglu32 -lopengl32 I would think..
[edited by - deadalive on April 30, 2003 2:09:13 PM]
"BECAUSE LINKING NOT DONE"
That means you have bigger problem than linking, inside your source code, so the linking part was never done. Maybe you have the right linker options, but it never got to that point because there are errors in the code. You never got the .c or .cpp to compile to a .o, so how can it link the .o into a .EXE ?
Another thing is the order of linker switches, you need to put it like -lglaux -lglu32 -lopengl32 I would think..
[edited by - deadalive on April 30, 2003 2:09:13 PM]
Just wild guess: Is your project producing executable or library? If your project is producing library, the it doesn't do linking, thus that error is understandable.
[edited by - stefu on April 30, 2003 2:43:42 PM]
[edited by - stefu on April 30, 2003 2:43:42 PM]
actualy a slitely different problem now. I am compiling a dll, it is my first time exparimenting with this, so I am a little confused by stefu said. I have got this dll working before when I had no opengl stuff included and no opengl functions called (I just had a function that created a popup). I had the -lopengl32 -lglaux -lglu32 in the wrong box I think now I'm geting:
here's the source:
and the header:
[edited by - neonoblivion on April 30, 2003 10:14:51 PM]
c:\giblets\gibmain.o(.text+0x4ea):gibmain.cpp: undefined reference to `glViewport@16'c:\giblets\gibmain.o(.text+0x4f7):gibmain.cpp: undefined reference to `glMatrixMode@4'c:\giblets\gibmain.o(.text+0x4ff):gibmain.cpp: undefined reference to `glLoadIdentity@0'c:\giblets\gibmain.o(.text+0x531):gibmain.cpp: undefined reference to `gluPerspective@32'c:\giblets\gibmain.o(.text+0x53e):gibmain.cpp: undefined reference to `glMatrixMode@4'c:\giblets\gibmain.o(.text+0x546):gibmain.cpp: undefined reference to `glLoadIdentity@0'c:\giblets\gibmain.o(.text+0x553):gibmain.cpp: undefined reference to `glShadeModel@4'c:\giblets\gibmain.o(.text+0x582):gibmain.cpp: undefined reference to `glClearColor@16'c:\giblets\gibmain.o(.text+0x591):gibmain.cpp: undefined reference to `glClearDepth@8'c:\giblets\gibmain.o(.text+0x5a1):gibmain.cpp: undefined reference to `glEnable@4'c:\giblets\gibmain.o(.text+0x5b1):gibmain.cpp: undefined reference to `glDepthFunc@4'c:\giblets\gibmain.o(.text+0x5c6):gibmain.cpp: undefined reference to `glHint@8'c:\giblets\gibmain.o(.text+0x606):gibmain.cpp: undefined reference to `wglMakeCurrent@8'c:\giblets\gibmain.o(.text+0x620):gibmain.cpp: undefined reference to `wglDeleteContext@4'Warning: no export definition file provideddllwrap will create one, but may not be what you wantC:\DEV-C_~1\BIN\dllwrap: gcc exited with status 1
here's the source:
#include <windows.h>#include <Gl\gl.h>#include <Gl\glu.h>#include <Gl\glaux.h>#define GIBAPI extern "C" __declspec(dllexport)#include "gibmain.h"HGLRC hrc;HDC hdc;HWND hwnd;HINSTANCE hin;HFONT font;GLuint PixelFormat;WNDCLASS winclass;bool fcflag;//fullscreen?int state;void setstate(int Gstate){ state=Gstate;}void bark(char * text, char * title){ MessageBox(NULL,text,title,MB_OK | MB_ICONINFORMATION);}LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam){PAINTSTRUCT ps; HDC hdc; switch(msg){ case WM_SYSCOMMAND: switch (wparam) { case SC_SCREENSAVE: case SC_MONITORPOWER: return(0); } case WM_CREATE:{ return(0); } break; case WM_PAINT:{ hdc = BeginPaint(hwnd,&ps); EndPaint(hwnd,&ps); return(0); } break; case WM_DESTROY:{ PostQuitMessage(0); return(0); } break; default:break; } return (DefWindowProc(hwnd, msg, wparam, lparam));}int createwindow( int posx, int posy, int width, int height, int bpp, char * title, bool fullscreen, float vangle, float near, float far, float r, float g, float b){ if (height==0){ height=1; } if(fcflag==1){ ChangeDisplaySettings(NULL,0); ShowCursor(TRUE); } wglMakeCurrent(NULL,NULL); if(hrc){ wglDeleteContext(hrc); hrc=NULL; } if(hdc){ ReleaseDC(hwnd,hdc); hdc=NULL; } if(hwnd){ DestroyWindow(hwnd); hwnd=NULL; } UnregisterClass("WINDOWS_CLASS_NAME",hin); hin=NULL; if(fullscreen==1) fcflag=1; DWORD dwExStyle; DWORD dwStyle; RECT WindowRect; WindowRect.left=(long)posx; WindowRect.right=(long)width; WindowRect.top=(long)posy; WindowRect.bottom=(long)height; hin = GetModuleHandle(NULL); winclass.style = CS_DBLCLKS | CS_OWNDC | CS_HREDRAW | CS_VREDRAW; winclass.lpfnWndProc = WndProc; winclass.cbClsExtra = 0; winclass.cbWndExtra = 0; winclass.hInstance = hin; winclass.hIcon = LoadIcon(NULL, IDI_APPLICATION); winclass.hCursor = LoadCursor(NULL, IDC_ARROW); winclass.hbrBackground = NULL; winclass.lpszMenuName = NULL; winclass.lpszClassName = "WINDOW_CLASS_NAME"; RegisterClass(&winclass); if(fullscreen==1){ DEVMODE dms; memset(&dms,0,sizeof(dms)); dms.dmSize=sizeof(dms); dms.dmPelsWidth = width; dms.dmPelsHeight = height; dms.dmBitsPerPel = bpp; dms.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT; if (ChangeDisplaySettings(&dms,0x00000004)!=DISP_CHANGE_SUCCESSFUL){ return(0); } } if (fullscreen==1){ dwExStyle=WS_EX_APPWINDOW; dwStyle=WS_POPUP; ShowCursor(FALSE); } else{ dwExStyle=WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; dwStyle=WS_OVERLAPPEDWINDOW; } AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle); if (!(hwnd = CreateWindowEx(dwExStyle, "WINDOW_CLASS_NAME", title, dwStyle | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, posx,posy, width,height, NULL, NULL, hin, NULL))){ return(0); } static PIXELFORMATDESCRIPTOR pfd= // pfd Tells Windows How We Want Things To Be { sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor 1, // Version Number PFD_DRAW_TO_WINDOW | // Format Must Support Window PFD_SUPPORT_OPENGL | // Format Must Support OpenGL PFD_DOUBLEBUFFER, // Must Support Double Buffering PFD_TYPE_RGBA, // Request An RGBA Format bpp, // Select Our Color Depth 0, 0, 0, 0, 0, 0, // Color Bits Ignored 0, // No Alpha Buffer 0, // Shift Bit Ignored 0, // No Accumulation Buffer 0, 0, 0, 0, // Accumulation Bits Ignored 16, // 16Bit Z-Buffer (Depth Buffer) 0, // No Stencil Buffer 0, // No Auxiliary Buffer PFD_MAIN_PLANE, // Main Drawing Layer 0, // Reserved 0, 0, 0 // Layer Masks Ignored }; hdc=GetDC(hwnd); PixelFormat=ChoosePixelFormat(hdc,&pfd); SetPixelFormat(hdc,PixelFormat,&pfd); hrc=wglCreateContext(hdc); wglMakeCurrent(hdc,hrc); ShowWindow(hwnd,SW_SHOW); SetForegroundWindow(hwnd); SetFocus(hwnd); glViewport(posx,posy,width,height); glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(60.0f,(GLfloat)width/(GLfloat)height,1.0f,101.0f); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glShadeModel(GL_SMOOTH); glClearColor(r,g,b, 0.5f); //glClearDepth((GLdouble)near); glClearDepth(1.0f); glEnable(GL_DEPTH_TEST); glDepthFunc(GL_LEQUAL); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);}void shutdown(){ ChangeDisplaySettings(NULL,0); ShowCursor(TRUE); wglMakeCurrent(NULL,NULL); if(hrc){ wglDeleteContext(hrc); hrc=NULL; } if(hdc){ ReleaseDC(hwnd,hdc); hdc=NULL; } if(hwnd){ DestroyWindow(hwnd); hwnd=NULL; } UnregisterClass("WINDOWS_CLASS_NAME",hin); hin=NULL;}
and the header:
#ifdef GIBAPI#else#define GIBAPI extern "C" __declspec(dllimport)#endif//#include <windows.h>//#include <Gl\gl.h>//#include <Gl\glu.h>//#include <Gl\glaux.h>GIBAPI void setstate(int state);GIBAPI void bark(char * text, char * title);GIBAPI int createwindow(int posx,int posy,int width,int height,int bpp,char * title, bool fullscreen,float vangle,float near,float far,float r, float g,float b);GIBAPI LRESULT CALLBACK WndProc(HWND hwnd,UINT msg,WPARAM wparam,LPARAM lparam);
[edited by - neonoblivion on April 30, 2003 10:14:51 PM]
Why are the #includes for <windows.h>, <Gl\gl.h>, <Gl\glu.h>, and <Gl\glaux.h> commented out?
I finally pinpointed it, I get errors when I check "Create a dll" under "project options" the only error I get with it unchecked is a:
"C:\DEV-C_~1\LIB\\libmingw32.a(main.o)(.text+0x8e): undefined reference to `WinMain@16''"
error which makes sense, please someone tell me whats going on
"C:\DEV-C_~1\LIB\\libmingw32.a(main.o)(.text+0x8e): undefined reference to `WinMain@16''"
error which makes sense, please someone tell me whats going on
Are you sure your project is set to use windows code? And AFAIK, glaux does not come with dev-cpp. I just switched to .net 2003, so those days are mostly behind me now..
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement