CDS_FULLSCREEN
I get an error for the following code:
_________________________________________________________________
if(ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN)!= DISP_CHAN_SUCCESSFUL) {
//Setting display mode failed.
MessageBox(NULL, "Display mode failed!", NULL, MB_OK);
fullscreen=FALSE;
} //End of if().
_________________________________________________________________
it says that CDS_FULLSCREEN is undeclared! i am so confused. i can''t even get my FIRST application to run! somebody please help.
Have you included all the required header files?
#include <windows.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>
Its one of these bad boys..
#include <windows.h>
#include <gl\gl.h>
#include <gl\glu.h>
#include <gl\glaux.h>
Its one of these bad boys..
You need to upgrade your MinGW32 headers, since you''re using very old headers that had CDS_FULLSCREEN missing. The headers can be found at mingw.sourceforge.net. Or, if you just want to halfway fix the problem, listen to Monder (although I''d brace it in a check to make sure CDS_FULLSCREEN isn''t already defined).
Thanks guys! that worked PERFECTLY! but now i have a bigger problem...
When i try to compile, it doesn''t have errors or anything, but i get this:
_________________________________________________________________
c:\csi\projects\game\maingame.cpp: In function `int WinMain(HINSTANCE__ *, HINSTANCE__ *, CHAR *, int)'':
c:\csi\projects\game\maingame.cpp:273: warning: converting NULL to non-pointer type
c:\csi\projects\game\maingame.cpp:285: warning: converting NULL to non-pointer type
c:\csi\projects\game\maingame.cpp:285: warning: converting NULL to non-pointer type
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0xf):maingame.cpp: undefined reference to `glEnable@4''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x1f):maingame.cpp: undefined reference to `glClearColor@16''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x2c):maingame.cpp: undefined reference to `glClear@4''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x34):maingame.cpp: undefined reference to `glLoadIdentity@0''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x39):maingame.cpp: undefined reference to `glFlush@0''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x47):maingame.cpp: undefined reference to `SwapBuffers@4''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x67):maingame.cpp: undefined reference to `ChoosePixelFormat@8''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x84):maingame.cpp: undefined reference to `SetPixelFormat@12''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x11b):maingame.cpp: undefined reference to `wglCreateContext@4''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x139):maingame.cpp: undefined reference to `wglMakeCurrent@8''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x15c):maingame.cpp: undefined reference to `wglMakeCurrent@8''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x16d):maingame.cpp: undefined reference to `wglDeleteContext@4''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x1bd):maingame.cpp: undefined reference to `glViewport@16''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x1ca):maingame.cpp: undefined reference to `glMatrixMode@4''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x1d2):maingame.cpp: undefined reference to `glLoadIdentity@0''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x204):maingame.cpp: undefined reference to `gluPerspective@32''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x211):maingame.cpp: undefined reference to `glMatrixMode@4''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x219):maingame.cpp: undefined reference to `glLoadIdentity@0''
_________________________________________________________________
what am i supposed to do NOW?
When i try to compile, it doesn''t have errors or anything, but i get this:
_________________________________________________________________
c:\csi\projects\game\maingame.cpp: In function `int WinMain(HINSTANCE__ *, HINSTANCE__ *, CHAR *, int)'':
c:\csi\projects\game\maingame.cpp:273: warning: converting NULL to non-pointer type
c:\csi\projects\game\maingame.cpp:285: warning: converting NULL to non-pointer type
c:\csi\projects\game\maingame.cpp:285: warning: converting NULL to non-pointer type
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0xf):maingame.cpp: undefined reference to `glEnable@4''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x1f):maingame.cpp: undefined reference to `glClearColor@16''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x2c):maingame.cpp: undefined reference to `glClear@4''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x34):maingame.cpp: undefined reference to `glLoadIdentity@0''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x39):maingame.cpp: undefined reference to `glFlush@0''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x47):maingame.cpp: undefined reference to `SwapBuffers@4''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x67):maingame.cpp: undefined reference to `ChoosePixelFormat@8''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x84):maingame.cpp: undefined reference to `SetPixelFormat@12''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x11b):maingame.cpp: undefined reference to `wglCreateContext@4''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x139):maingame.cpp: undefined reference to `wglMakeCurrent@8''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x15c):maingame.cpp: undefined reference to `wglMakeCurrent@8''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x16d):maingame.cpp: undefined reference to `wglDeleteContext@4''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x1bd):maingame.cpp: undefined reference to `glViewport@16''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x1ca):maingame.cpp: undefined reference to `glMatrixMode@4''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x1d2):maingame.cpp: undefined reference to `glLoadIdentity@0''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x204):maingame.cpp: undefined reference to `gluPerspective@32''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x211):maingame.cpp: undefined reference to `glMatrixMode@4''
C:\WINDOWS\TEMP\ccFOVhgb.o(.text+0x219):maingame.cpp: undefined reference to `glLoadIdentity@0''
_________________________________________________________________
what am i supposed to do NOW?
You have to link OpenGL (for MinGW32 libraries you add -lopengl32 -lglu32 to the command line) and a part of the Win32 API (-lgdi32) that appears to be not being linked.
I''m assuming you''re using dev-c++ here cause you seem confused by the command line.
Go to something like project->linker options(it''s something like that) and in the extra libarys textbox put -lopengl32 -lglu32 oh and make sure you started a windows project. If you aren''t using dev-c++ post back with the compiler you are using
Go to something like project->linker options(it''s something like that) and in the extra libarys textbox put -lopengl32 -lglu32 oh and make sure you started a windows project. If you aren''t using dev-c++ post back with the compiler you are using
In Dev-C++ you can go to the project options (I think you can press alt+p to get there) and there is a text box somewhere for you to add options for when it calls the linker. The -l switch tells it you want to link to a library, and you follow it with it''s name, so you will put -lopengl32 and -lglu32 in that box.
While you''re there, you might want to add -Wall to the compiler options. (it''s case sensitive!) This will cause the compiler to tell you when you do stupid things, like statements that do nothing, writing if(a=4), declaring variables and not using them, not initializing variables, and other odd things like that that tend to make people scream.
While you''re there, you might want to add -Wall to the compiler options. (it''s case sensitive!) This will cause the compiler to tell you when you do stupid things, like statements that do nothing, writing if(a=4), declaring variables and not using them, not initializing variables, and other odd things like that that tend to make people scream.
quote:Original post by Monder
just put
#define CDS_FULLSCREEN 4
at the top of your code and everything should work fine
You should probably use
#ifndef CDS_FULLSCREEN
#define CDS_FULLSCREEN 4
#endif
so it works for people who don''t have buggy headers.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement