Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Stranded\1.3.cpp" -o "C:\Stranded\1.3.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
C:\Stranded\1.3.cpp: In function bool InitializeD3D(HWND__*, bool)':
C:\Stranded\1.3.cpp:5: error:D3DDISPLAYMODE' undeclared (first use this function)
C:\Stranded\1.3.cpp:5: error: (Each undeclared identifier is reported only once for each function it appears in.)
C:\Stranded\1.3.cpp:5: error: expected `;' before "displayMode"
C:\Stranded\1.3.cpp:8: error: `g_D3D' undeclared (first use this function)
C:\Stranded\1.3.cpp:8: error: D3D_SDK_VERSION' undeclared (first use this function)
C:\Stranded\1.3.cpp:8: error:Direct3DCreate9' undeclared (first use this function)
C:\Stranded\1.3.cpp:12: error: D3DADAPTER_DEFAULT' undeclared (first use this function)
C:\Stranded\1.3.cpp:12: error:displayMode' undeclared (first use this function)
C:\Stranded\1.3.cpp:16: error: D3DPRESENT_PARAMETERS' undeclared (first use this function)
C:\Stranded\1.3.cpp:16: error: expected;' before "d3dpp"
C:\Stranded\1.3.cpp:17: error: d3dpp' undeclared (first use this function)
C:\Stranded\1.3.cpp:27: error:D3DSWAPEFFECT_DISCARD' undeclared (first use this function)
C:\Stranded\1.3.cpp:31: error: D3DDEVTYPE_HAL' undeclared (first use this function)
C:\Stranded\1.3.cpp:31: error:D3DCREATE_HARDWARE_VERTEXPROCESSING' undeclared (first use this function)
C:\Stranded\1.3.cpp:31: error: `g_D3DDevice' undeclared (first use this function)
Execution terminated
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"i also did not have to have "error" in my message box it just made things further complicated."
That may be true but YOU Complicated things, I gave you the messagebox all you had to do was copy and paste.
You put the extra NULL in what was already there.
Nice to see you have it working but I am sure we will hear from you again...fairly soon I bet.
I wish you would have anwser the questions about programming I put on this thread twice.....but wish in one hand and Sh*t in another and see which one fills up faster.....so they say.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The missing D3DDISPLAYMODE is teh least of your worries. Notice that ALL of the DirectX symbols you have used are not recognised!
The DirectX SDK is (probably) not legally redistributable and is not part of Dev-C++ or MinGW. The Microsoft DirectX SDK is downloadable, but will not work directly with MinGW. There was a DirectX DevPak available at http://www.g-productions.net/index.php?c=files_devpak. But unsurprisingly it has been withdrawn for legal reasons.
The path of least resistance if you want to use DirectX is to use a Microsoft tool (they are free too!). http://www.microsoft.com/express/vc/Default.aspx . Doing that offers up other options such as DarkGDK for example.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Well that will be where the header files are, but not where the libraries are. Header files are not libraries. In C:\Dev-Cpp\lib\GL perhaps?
As ever POST THE COMPILE LOG!!! You did it the first time, why not the second?
>> im wondering if i go to compiler options in devcpp and add each one under the C++ Includes
Had you posted the Compile Log we would be able to tell you what you need to do!
Since this is a linker error, compilation must have been successful, so you need not change any compiler options. Unfortunately Dev-C++ does not clearly distinguish between linker and compiler options (it even has some compiler options in the linker options section! And it invokes the linker through the compiler interface to further obfuscate what is really happening).
You need to add the library path to the Linker directories, and you need to add the libraries to the linker options. The linker invokation in the log (the stage that builds the executable) should have -L<path> options to the location of the libraries, and -l<library> options to the actual libraries you wish to link
In the thread titled "Please Read Before Posting a Question", there is a section
on getting started with Glut. It tells you where to get the right package, where
to put things and how to link it all.
If you are still having a problem, please remember to post your full Basic 3, which
are also covered in the "Please Read" thread.
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
ok through many of trial and errors..i still have errors
Adding the Library Path to the Linker Directories: ok so i added 'C:\Dev-Cpp\lib\GL' under the Lib 'Tab' in the Directories.
Adding the Libarires to the Linker Options(LO's is the Blank space for -L and -I?)its under the 'Compiler Tab' and i've checked the box that says 'Add these commands'.
so i've tried both -I and -Lopengl32.lib in what i hope is the Linker Options.
i am not using GLUT
only opengl32.lib and glu32.lib are necessary to be linked?
they are under C:\Dev-Cpp\lib\GL
Here is my Compile log:
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Stranded\OGL.cpp" -o "C:\Stranded\OGL.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib\GL" -Lopengl32.lib
C:\DOCUME~1\Owner\LOCALS~1\Temp/ccc1caaa.o(.text+0x36):OGL.cpp: undefined reference to wglCreateContext@4'
C:\DOCUME~1\Owner\LOCALS~1\Temp/ccc1caaa.o(.text+0x54):OGL.cpp: undefined reference towglMakeCurrent@8'
C:\DOCUME~1\Owner\LOCALS~1\Temp/ccc1caaa.o(.text+0x6e):OGL.cpp: undefined reference to wglMakeCurrent@8'
C:\DOCUME~1\Owner\LOCALS~1\Temp/ccc1caaa.o(.text+0x7e):OGL.cpp: undefined reference towglDeleteContext@4'
C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../libmingw32.a(main.o)(.text+0x106):main.c: undefined reference to `WinMain@16'
collect2: ld returned 1 exit status
Execution terminated
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Files with .lib extension are generally not GNU libraries, (usually Microsoft or Borland). If you have a library of this type, it will not work (at least not without an upgrade to GCC 4.x) or an export library conversion using reimp. That is not necessary however a working GNU/MinGW openGL library is available.
The GNU naming convention for libraries is libXXX.a, where the library may be linked by -lXXX. Note that is lowercase-L!. By using uppercase-L the linker will merely interpret the option as another library search path (look at your log, you will see it inserted in the command line in the same way as the lib directory - how is the likner expected to distinguish them!?)
-I is a compiler option. You don't put these in the linker options. Besides this is done for you when you add directories to the Include Directories tab, you do not need to add them explicitly as options.
You may specify a library to be linked by its full path and name. This can be done by using the "Add object file or library" button. When you do do this -l is not used. Get into the habit of looking at the command invokation in teh compile log so you understand how your dialog settings affect how the compiler is driven. When you reference the GNU documentation, it is this command line you mustr refer to.
Since you appear to be trying to use OpenGL, have you read the section
in the "Please Read" thread on getting started with Glut (OpenGL)?
It tells you what to get, where to get it, where to put it, and how
to compile and link some simple examples. This is a better place to
go than the thrashing mode you seem to be in. (That is not an insult
by the way, I can tell you I get in thrashing mode several times a
week).
Wayne
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
>> I tried downloading one of the GCC's 'gcc-4.0.0.tar.gz'
I never intended that as a serious suggestion, I am not sure why you would have interpreted it as such - it was in parentheses for a reason - it was an aside, merely an observation that GCC 4.x has support for Microsoft format object files and libraries. You really should have taken my advice and got yourself a working GNU/MinGW openGL library build.
Getting GCC working from the source download is for experts, and even then it's not necessarily easy, especially on Windows. This is probably why MinGW (a Windows port of GCC) is so far behind the leading edge). The compiler used by default by Dev-C++ is 'special'; it is GCC but does not require a Unix-like environment to run, and neither does teh code you use it to build - getting that to happen is no mean feat. The other way to get GCC te run on Windows is to use the Cygwin Linux emulation layer - it is huge, cumbersome, and distributing your applications usually requires users to have a Cygwin installation too.
GCC comes as source code (that is what open source means!). To get a binary you can just use, you need a distribution. And you need it for your platform.
If there is an updated version of MinGW you'll get it at www.mingw.org. The current release of MinGW/GCC is 3.4.5 (insignificantly newer than Dev-C++'s 3.4.2. There is a "Technology Preview" release on 4.2.1 for MinGW. This distribution will have had much less testing time put in on it.
Of course if you have a Microsoft library, the easiest path is to use a Microsoft compiler.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I may have misled you rather. Most people it seems (I don't use it myself) use OpenGL through the GLUT toolkit (for which you need to download the library). Raw OpenGL however is supported already by in the Dev-C++ distribution. I would have told you that had I been aware of it - honest!
OpenGL is provided by the Windows operating system as a DLL. All you need to use it is an export library. If you are using raw OpenGL rather than GLUT, then you need do nothing more that link the libopengl32.a by adding the linker option -lopengl32. You have done that and resolved all your missing OpenGL references - now you have an entirely different problem unrelated to OpenGL.
Your code has no entry point. WndProc() is not a recognised entry point. On Win32 only main() and WinMain() are recognised entry points. WinMain() is used for Win32 GUI apps, and main() for console apps. OpenGL can be used in either, all the examples on the GLUT thread are written as console apps. The fundamental difference is that a GUI app does not display a console. It only displays anything if you tell it to (usually by creating a window). GUI apps are generally have more a more complex structure - having a Windows message processing loop. Your WndProc function would be called from such a loop. If you wish to write your program this way, and are not sure how to start, I suggest that you start your project using the Win32 GUI project template (File->New->Project), and the OpenGL library to the build, and insert your code into the WndProc function that the template provides.
The __cpu_features_init error is most often caused by mixing compiler, linker, and library from different and incompatible tool-chains. Maybe you screwed up your installation with the GCC 4.x attempt (perhaps I should never have mentioned it, I should have known better or realised that you wouldn't!).
This is compiled C programming BTW not scripting! It is not referred to as a script, merely code, source code or program. Scripting is done in scripting languages, C is not a scripting language. http://en.wikipedia.org/wiki/Scripting_language. I feel better now! ;-)
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
How about let's concentrate on one problem at at time!? This is an entirely different question, and probably therefore deserves a new thread. Have you resolved the first problem?
The first thing I would say is that C:\Dev-Cpp\ATimetoKill is not a good place to keep your project. Apart from being a generally bad idea to 'pollute' an application installation with user files, there is in fact a bug in Dev-C++ that in some circumstances prevents projects from building when in c:\dev-cpp or subfolders thereof.
>> which is probably telling me to switch over to MVC++
If this is someone else's code it may be true that it was intended for MSVC++, but unless it relies upon MFC or some other Microsoft specific technology it would be portable. Either way the error messages do not indicate that conclusion - have you actually bothered to read them and the code to which they refer? That is after all what they are for!
>> Im guessing i cant have a MainWindowProc() as an Entry Point in Windows Applications?
It is not my business to teach you Windows programming, but it is in your interest to at least get the fundamentals under your belt before you launch into OpenGL or any other advanced programming. You don't need to 'guess' anything! I told you exactly how to create a basic Windows GUI application framework. Don't insult be by not reading the advice you asked for.
>> CGfxOpenGL.h:1:1: unterminated #ifndef
Means exactly what it says. Let me guess, line 1 says something like:
ifndef __GL_COMPONENT
at the end of the file there should be a corresponding #endif. You don't need to know anything about Windows programming or OpenGL to figure that one out! Perhaps you failed to copy & paste the code completely?
With respect to the other the other errors, well you have the benefit of both the error log and the code but have only given us one of those, and I have done enough guessing. It seems as if you don't really want your problem solved! What do lines 42, 46, 47 and 48 look like? Actually you should probably post all the code up to line 48. If this is not your code, you might simply post a link to where you obtained it. Fix the #ifndef error first and try again first though (and post the new log with the code).
>> in a differnt 'script'(corret me if im wrong plz)
I already did, now you are just being perverse (and illiterate).
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
yeah, #endif at the end of the CGfxOpenGL header file worked! As u knew it would? :)
I read again what u typed about WndProcedures not being valid Entry Points, i dont know how to create a Win32 GUI App in devcpp. You said File>New>Project but theres nothing that says GUI APP. There is a Standard Windows Application Icon, but thats what i have been using to type the code in.
if i type my code in a Win32 GUI APP i will not experience WinMain@16 errors?
hers the code,
define WIN32_LEAN_AND_MEAN
define WIN32_EXTRA_LEAN
include <windows.h>
include <gl/gl.h>
include <gl/glu.h>
include "CGfxOpenGL.h"
bool exiting = false;
long windowWidth = 1024;
long windowHeight = 768;
long windowBits = 32;
bool fullscreen = false;
HDC hDC;
// global poointer to the CGfxOpenGL fendering class
CGfxOpenGL *g_glRender = NULL;
winmain.cpp: In function void SetupPixelFormat(HDC__*)':
winmain.cpp:42: error: expected}' before numeric constant
winmain.cpp:42: error: expected ,' or;' before numeric constant
winmain.cpp: At global scope:
winmain.cpp:46: error: expected constructor, destructor, or type conversion before '=' token
winmain.cpp:46: error: expected ,' or;' before '=' token
winmain.cpp:47: error: expected constructor, destructor, or type conversion before '(' token
winmain.cpp:47: error: expected ,' or;' before '(' token
winmain.cpp:48: error: expected declaration before '}' token
make.exe: *** [winmain.o] Error 1
Execution terminated
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Missing comma after PFD_MAIN_PLANE in pfd initialiser. Read the error messages! Here line 42 (the line after the error) makes no sense in the context of the missing comma. The compiler will not always be able to tell you where the error is, but rather where the code stopped making sense. You need to look it in that way.
Also the last comma in the initialiser:
0, 0, 0, // NO LAYER, VISIBLE, DAMAGE MASK
should not be there.
You cannot go through this being spoon fed, you have to learn to diagnose these simple errors yourself.
However see how quickly you get a solution what you post good information!?
> [...]Standard Windows Application Icon[...]
Yes that's the one. I do not have Dev-C++ installed on this PC so that was from memory ... sorry if that caused confusion.
The template code has a WinMain() function. You should not replace or modify it (at least not until you know what you are doing). It will call teh message handler procedure (probably called WndProc or similar), and that is where you place your code. Before you do nay of that have you tried building the unmodified template code just to be sure you can? If when you add your code it fails, you know it is something you did rather than a problem with the tool.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
C:\ATimetoKill\winmain.cpp:186: warning: passing NULL used for non-pointer converting 1 of `HWND CreateWindowExA(DWORD, const CHAR, const CHAR*, DWORD, int, int, int, int, HWND, HMENU*, HINSTANCE, void*)'
C:\DOCUME~1\Owner\LOCALS~1\Temp/ccKgcaaa.o(.text+0x44):winmain.cpp: undefined reference to ChoosePixelFormat@8'
C:\DOCUME~1\Owner\LOCALS~1\Temp/ccKgcaaa.o(.text+0x63):winmain.cpp: undefined reference toSetPixelFormat@12'
C:\DOCUME~1\Owner\LOCALS~1\Temp/ccKgcaaa.o(.text+0x182):winmain.cpp: undefined reference to CGfxOpenGL::SetupProjection(int, int)'
C:\DOCUME~1\Owner\LOCALS~1\Temp/ccKgcaaa.o(.text+0x248):winmain.cpp: undefined reference toCGfxOpenGL::CGfxOpenGL()'
C:\DOCUME~1\Owner\LOCALS~1\Temp/ccKgcaaa.o(.text+0x564):winmain.cpp: undefined reference to `CGfxOpenGL::Init()'
C:\DOCUME~1\Owner\LOCALS~1\Temp/ccKgcaaa.o(.text+0x591):winmain.cpp: undefined reference to CGfxOpenGL::Prepare(float)'
C:\DOCUME~1\Owner\LOCALS~1\Temp/ccKgcaaa.o(.text+0x59e):winmain.cpp: undefined reference toCGfxOpenGL::Render()'
C:\DOCUME~1\Owner\LOCALS~1\Temp/ccKgcaaa.o(.text+0x5ab):winmain.cpp: undefined reference to `SwapBuffers@4'
collect2: ld returned 1 exit status
Execution terminated
And heres the code up until line 186,
define WIN32_LEAN_AND_MEAN
define WIN32_EXTRA_LEAN
include <windows.h>
include <gl/gl.h>
include <gl/glu.h>
include "CGfxOpenGL.h"
bool exiting = false;
long windowWidth = 800;
long windowHeight = 600;
long windowBits = 32;
bool fullscreen = false;
HDC hDC;
// global poointer to the CGfxOpenGL fendering class
CGfxOpenGL *g_glRender = NULL;
void SetupPixelFormat(HDC hDC)
{
int pixelFormat;
PIXELFORMATDESCRIPTOR pfd =
{
sizeof(PIXELFORMATDESCRIPTOR), // SIZE
1, // version
PFD_SUPPORT_OPENGL |
PFD_DRAW_TO_WINDOW |
PFD_DOUBLEBUFFER,
PFD_TYPE_RGBA,
32,
0, 0, 0, 0, 0, 0, // COLOR BITS, IGNORED
0,
0,
0,
0, 0, 0, 0,
16,
0,
0,
PFD_MAIN_PLANE,
0, // reserved
0, 0, 0 // NO LAYER, VISIBLE, DAMAGE MASK
};
pixelFormat = ChoosePixelFormat(hDC, &pfd);
SetPixelFormat(hDC, pixelFormat, &pfd);
}
LRESULT CALLBACK MainWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
static HDC hDC;
static HGLRC hRC;
int height, width;
// Dispatch Messages
switch (uMsg)
{
case WM_CREATE:
hDC = GetDC(hWnd);
SetupPixelFormat(hDC);
hRC = wglCreateContext(hDC);
wglMakeCurrent(hDC, hRC);
break;
case WM_DESTROY:
case WM_QUIT:
case WM_CLOSE:
// deselect rednering context and delete it
wglMakeCurrent(hDC, NULL);
wglDeleteContext(hRC);
// send WM_QUIT message queue
PostQuitMessage(0);
break;
case WM_SIZE:
height = HIWORD(lParam); // retrireving window sizes
width = LOWORD(lParam);
g_glRender->SetupProjection(width, height);
break;
case WM_KEYDOWN: // enables users key function
int fwKeys;
LPARAM keyData;
fwKeys = (int)wParam; // virtual key code
keyData = lParam; // the key data
switch(fwKeys)
{
case VK_ESCAPE:
PostQuitMessage(0);
break;
default:
break;
}
break;
default:
break;
}
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
lpCmdLine, int nShowCmd)
{
WNDCLASSEX windowClass;
HWND hwnd;
MSG msg;
DWORD dwExStyle;
DWORD dwStyle;
RECT windowRect;
g_glRender = new CGfxOpenGL;
windowRect.left=(long)0; // left value
windowRect.right=(long)windowWidth;
windowRect.top=(long)0;
windowRect.bottom=(long)windowHeight;
// fill out the window class structure
windowClass.cbSize = sizeof(WNDCLASSEX);
windowClass.style = CS_HREDRAW | CS_VREDRAW;
windowClass.lpfnWndProc = MainWindowProc;
windowClass.cbClsExtra = 0;
windowClass.cbWndExtra = 0;
windowClass.hInstance = hInstance;
windowClass.hIcon = LoadIcon(NULL, IDI_APPLICATION); // default icon
windowClass.hCursor = LoadCursor(NULL, IDC_ARROW);
windowClass.lpszMenuName = NULL;
windowClass.lpszClassName = NULL;
windowClass.lpszClassName = "GLCLass";
windowClass.hIconSm = LoadIcon(NULL, IDI_WINLOGO);
// register the windows class
if (!RegisterClassEx(&windowClass))
return 0;
if (fullscreen)
{
DEVMODE dmScreenSettings;
memset(&dmScreenSettings,0,sizeof(dmScreenSettings));
dmScreenSettings.dmSize = sizeof(dmScreenSettings);
dmScreenSettings.dmPelsWidth = windowWidth;
dmScreenSettings.dmPelsHeight = windowHeight;
dmScreenSettings.dmBitsPerPel = windowBits;
dmScreenSettings.dmFields=DM_BITSPERPEL|DM_PELSWIDTH|DM_PELSHEIGHT;
if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) !=DISP_CHANGE_SUCCESSFUL)
{
// setting display mode failed switch to windowed
MessageBox(NULL, "Display Mode failed....LOLU!", NULL, MB_OK);
fullscreen = FALSE;
}
}
if (fullscreen) // are we still FSM?
{
dwExStyle=WS_EX_APPWINDOW; // WINDOW_EXTENDED_style
dwStyle=WS_OVERLAPPEDWINDOW;
}
// adjust window to True Reqeuested size
AdjustWindowRectEx(&windowRect, dwStyle, FALSE, dwExStyle);
// class register so now create our window
hwnd = CreateWindowEx(NULL, // extended style
"GLClass", // class name
"BOGLGP - An OpenGL Application",
dwStyle | WS_CLIPCHILDREN |
WS_CLIPSIBLINGS,
0, 0, // "X" AND "Y" COORDINATES
windowRect.right - windowRect.left,
windowRect.bottom - windowRect.top, // width, height
NULL, // handel to parent
NULL, // handle to menu
hInstance,
NULL);
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
is nonsense. I went thorugh this at length in my post on 10 January. Read it again!
I'll say it again for the hard-of-thinking: -L is a linker option to specify a folder path that contains libraries.
To link an object file, you merely specify its path/filename on the command line. You cannot 'link' a source file (much less a header file!), you have to compile it first (or in the case of a header, #include it in a file that you are compiling.
To compile and link multiple sources in Dev-C++ you must use a project (File->New->Project...). You then simply add the .cpp or .c source files to the project (Project->Add file). You can add headers (and any other files) as well for ease of access for editing, but it makes no difference to how the code is built. When you do this Dev-C++ will compile and link each source file separately and link the generated object code.
Your log indicates that you are not using a project and certainly not compiling and linking CGfxOpenGL.cpp - it shows the direct compilation and linking of winmain.cpp only.
The warning is quite clear, you have passed NULL (which has pointer type) for a parameter of type DWORD (an integer type). You almost certainly intended zero (0) rather than NULL. If you copied this code from somewhere else it may be indicitive of the quality (or lack thereof) of your source material.
Clifford
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This more or less looks like someone trying to jump into 3D programming with out knowing how to program. In order to be efficient at 3D programming you need to have some kind of clue as to what you are doing and IMO you don't. Also IMO you can not read as you seem to only take the things you want from a response. I would highly suggest you listen to Clifford as when it comes down to it he knows his stuff and is one of the best resources you may ever find.
Maybe read the responses several times to ensure you understand and comprehend what you are being told.
My hats off to you C for your patience with this topic.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
i did manage to fix three of the erros by adding -lgdi32 to the linker option.
i also changed both of the NULL's to (0) which fixed the error in line 186
but i still do not understand how to fix or 'define' the 'undefined references' for CGfxOpenGL terms.
it says `CGfxOpenGL::SetupProjection(int, int)' the '::' is not present in the project im compiling(winmain.cpp) but it is found in CGfxOpengl.cpp that i had compiled w/o errors earlier.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
My version number of devcpp is 4.9.9.2 and im using a windows 2002 OS
The D3DDISPLAYMODE is not declared and im wanting to know what to put in #include< >
include <windows.h>
bool InitializeD3D(HWND hWnd, bool fullscreen)
{
D3DDISPLAYMODE displayMode;
Executing g++.exe...
g++.exe "C:\Stranded\1.3.cpp" -o "C:\Stranded\1.3.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
C:\Stranded\1.3.cpp: In function
bool InitializeD3D(HWND__*, bool)': C:\Stranded\1.3.cpp:5: error:
D3DDISPLAYMODE' undeclared (first use this function)C:\Stranded\1.3.cpp:5: error: (Each undeclared identifier is reported only once for each function it appears in.)
C:\Stranded\1.3.cpp:5: error: expected `;' before "displayMode"
C:\Stranded\1.3.cpp:8: error: `g_D3D' undeclared (first use this function)
C:\Stranded\1.3.cpp:8: error:
D3D_SDK_VERSION' undeclared (first use this function) C:\Stranded\1.3.cpp:8: error:
Direct3DCreate9' undeclared (first use this function)C:\Stranded\1.3.cpp:12: error:
D3DADAPTER_DEFAULT' undeclared (first use this function) C:\Stranded\1.3.cpp:12: error:
displayMode' undeclared (first use this function)C:\Stranded\1.3.cpp:16: error:
D3DPRESENT_PARAMETERS' undeclared (first use this function) C:\Stranded\1.3.cpp:16: error: expected
;' before "d3dpp"C:\Stranded\1.3.cpp:17: error:
d3dpp' undeclared (first use this function) C:\Stranded\1.3.cpp:27: error:
D3DSWAPEFFECT_DISCARD' undeclared (first use this function)C:\Stranded\1.3.cpp:31: error:
D3DDEVTYPE_HAL' undeclared (first use this function) C:\Stranded\1.3.cpp:31: error:
D3DCREATE_HARDWARE_VERTEXPROCESSING' undeclared (first use this function)C:\Stranded\1.3.cpp:31: error: `g_D3DDevice' undeclared (first use this function)
Execution terminated
"i also did not have to have "error" in my message box it just made things further complicated."
That may be true but YOU Complicated things, I gave you the messagebox all you had to do was copy and paste.
You put the extra NULL in what was already there.
the "Error" is the caption to the messagebox.
http://msdn2.microsoft.com/en-us/library/ms645505.aspx
Nice to see you have it working but I am sure we will hear from you again...fairly soon I bet.
I wish you would have anwser the questions about programming I put on this thread twice.....but wish in one hand and Sh*t in another and see which one fills up faster.....so they say.
The missing D3DDISPLAYMODE is teh least of your worries. Notice that ALL of the DirectX symbols you have used are not recognised!
The DirectX SDK is (probably) not legally redistributable and is not part of Dev-C++ or MinGW. The Microsoft DirectX SDK is downloadable, but will not work directly with MinGW. There was a DirectX DevPak available at http://www.g-productions.net/index.php?c=files_devpak. But unsurprisingly it has been withdrawn for legal reasons.
The path of least resistance if you want to use DirectX is to use a Microsoft tool (they are free too!). http://www.microsoft.com/express/vc/Default.aspx . Doing that offers up other options such as DarkGDK for example.
Clifford
is there an SDK that is recognised by Dev-C++ and the MinGW?
If you mean a DirectX SDK sid not just answer that? DirectX is Microsoft's library.
You can use OpenGL with MinGW/Dev-C++.
Clifford
I am sure that really said "...did I not just answer that?" when I posted it. :-o
im having a [Linker Error] with my opengl script
i do have all the files needed for opengl under windows.
i have them safely in C:\Dev-Cpp\include\GL
im wondering if i go to compiler options in devcpp and add each one under the C++ Includes
Or do i turn some no answers to Yes, under the settings then Linker option?
>>i have them safely in C:\Dev-Cpp\include\GL
Well that will be where the header files are, but not where the libraries are. Header files are not libraries. In C:\Dev-Cpp\lib\GL perhaps?
As ever POST THE COMPILE LOG!!! You did it the first time, why not the second?
>> im wondering if i go to compiler options in devcpp and add each one under the C++ Includes
Had you posted the Compile Log we would be able to tell you what you need to do!
Since this is a linker error, compilation must have been successful, so you need not change any compiler options. Unfortunately Dev-C++ does not clearly distinguish between linker and compiler options (it even has some compiler options in the linker options section! And it invokes the linker through the compiler interface to further obfuscate what is really happening).
You need to add the library path to the Linker directories, and you need to add the libraries to the linker options. The linker invokation in the log (the stage that builds the executable) should have -L<path> options to the location of the libraries, and -l<library> options to the actual libraries you wish to link
Note that with GLUT libraries (if that is what you are using), link order is significant since some libraries have dependencies on others. See: http://sourceforge.net/forum/message.php?msg_id=4633347 .
Clifford
In the thread titled "Please Read Before Posting a Question", there is a section
on getting started with Glut. It tells you where to get the right package, where
to put things and how to link it all.
If you are still having a problem, please remember to post your full Basic 3, which
are also covered in the "Please Read" thread.
Wayne
ok through many of trial and errors..i still have errors
Adding the Library Path to the Linker Directories: ok so i added 'C:\Dev-Cpp\lib\GL' under the Lib 'Tab' in the Directories.
Adding the Libarires to the Linker Options(LO's is the Blank space for -L and -I?)its under the 'Compiler Tab' and i've checked the box that says 'Add these commands'.
so i've tried both -I and -Lopengl32.lib in what i hope is the Linker Options.
i am not using GLUT
only opengl32.lib and glu32.lib are necessary to be linked?
they are under C:\Dev-Cpp\lib\GL
Here is my Compile log:
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Stranded\OGL.cpp" -o "C:\Stranded\OGL.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib\GL" -Lopengl32.lib
C:\DOCUME~1\Owner\LOCALS~1\Temp/ccc1caaa.o(.text+0x36):OGL.cpp: undefined reference to
wglCreateContext@4' C:\DOCUME~1\Owner\LOCALS~1\Temp/ccc1caaa.o(.text+0x54):OGL.cpp: undefined reference to
wglMakeCurrent@8'C:\DOCUME~1\Owner\LOCALS~1\Temp/ccc1caaa.o(.text+0x6e):OGL.cpp: undefined reference to
wglMakeCurrent@8' C:\DOCUME~1\Owner\LOCALS~1\Temp/ccc1caaa.o(.text+0x7e):OGL.cpp: undefined reference to
wglDeleteContext@4'C:/Dev-Cpp/Bin/../lib/gcc/mingw32/3.4.2/../../../libmingw32.a(main.o)(.text+0x106):main.c: undefined reference to `WinMain@16'
collect2: ld returned 1 exit status
Execution terminated
Files with .lib extension are generally not GNU libraries, (usually Microsoft or Borland). If you have a library of this type, it will not work (at least not without an upgrade to GCC 4.x) or an export library conversion using reimp. That is not necessary however a working GNU/MinGW openGL library is available.
The GNU naming convention for libraries is libXXX.a, where the library may be linked by -lXXX. Note that is lowercase-L!. By using uppercase-L the linker will merely interpret the option as another library search path (look at your log, you will see it inserted in the command line in the same way as the lib directory - how is the likner expected to distinguish them!?)
-I is a compiler option. You don't put these in the linker options. Besides this is done for you when you add directories to the Include Directories tab, you do not need to add them explicitly as options.
You may specify a library to be linked by its full path and name. This can be done by using the "Add object file or library" button. When you do do this -l is not used. Get into the habit of looking at the command invokation in teh compile log so you understand how your dialog settings affect how the compiler is driven. When you reference the GNU documentation, it is this command line you mustr refer to.
To get an understanding of the difference between linking and compiling, and the build process in general read this: https://sourceforge.net/forum/message.php?msg_id=2670009
Clifford
I tried downloading one of the GCC's 'gcc-4.0.0.tar.gz' but im unsure as to where to put it. GZ prolly isnt the rite type of file or gcc
after having GCC 4.0 in the correct directory '-lopengl32.lib' would then work in the Linker Options? or is it 'libopengl32.a' ?
and a working GNU/MinGW openGL library is available where? After having this, would it allow me to then Link .lib files?
Again, im trying to compile a simple OpenGL Application with this source code.
include <windows.h>
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static HGLRC hRC;
static HDC hDC;
3.Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Stranded\OGL.cpp" -o "C:\Stranded\OGL.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib\GL" -lglu32.lib
C:\Dev-Cpp\Bin..\lib\gcc\mingw32\3.4.2........\mingw32\bin\ld.exe: cannot find -lglu32.lib
collect2: ld returned 1 exit status
Execution terminated
It looks like you downloaded the source for GCC - which will do nothing until you build it.
Building GCC requires a working compiler and quite a bit of skill to do the "bootstrap",
and I don't think it has anything to do with your problem.
Wayne
Since you appear to be trying to use OpenGL, have you read the section
in the "Please Read" thread on getting started with Glut (OpenGL)?
It tells you what to get, where to get it, where to put it, and how
to compile and link some simple examples. This is a better place to
go than the thrashing mode you seem to be in. (That is not an insult
by the way, I can tell you I get in thrashing mode several times a
week).
Wayne
>> I tried downloading one of the GCC's 'gcc-4.0.0.tar.gz'
I never intended that as a serious suggestion, I am not sure why you would have interpreted it as such - it was in parentheses for a reason - it was an aside, merely an observation that GCC 4.x has support for Microsoft format object files and libraries. You really should have taken my advice and got yourself a working GNU/MinGW openGL library build.
Getting GCC working from the source download is for experts, and even then it's not necessarily easy, especially on Windows. This is probably why MinGW (a Windows port of GCC) is so far behind the leading edge). The compiler used by default by Dev-C++ is 'special'; it is GCC but does not require a Unix-like environment to run, and neither does teh code you use it to build - getting that to happen is no mean feat. The other way to get GCC te run on Windows is to use the Cygwin Linux emulation layer - it is huge, cumbersome, and distributing your applications usually requires users to have a Cygwin installation too.
GCC comes as source code (that is what open source means!). To get a binary you can just use, you need a distribution. And you need it for your platform.
If there is an updated version of MinGW you'll get it at www.mingw.org. The current release of MinGW/GCC is 3.4.5 (insignificantly newer than Dev-C++'s 3.4.2. There is a "Technology Preview" release on 4.2.1 for MinGW. This distribution will have had much less testing time put in on it.
Of course if you have a Microsoft library, the easiest path is to use a Microsoft compiler.
Clifford
So i cannot get my script to work without a working GNU/MinGW openGL library? i really dont know how to build one.
Also i did read the getting started with GLUT/OpenGL and i am still unable to get my script working.
I put gl.h glu.h and glut.h in C:\Dev-Cpp\include
I put the .lib files in C:\Dev-Cpp\lib\GL
And i put the .dll files into C:\Dev-Cpp\bin
I have -lglu32 -lopengl32 in the linker command line. i think these might be the wrong commands for the type of script im compiling
I am not yet using GLUT although i do have it installed
In the Compiler Options/Directories/libraries i have it set to 'C:\Dev-Cpp\lib' rather then 'C:\Dev-Cpp\lib\GL'
Is there anything i would need to add to C:\Dev-Cpp\lib to prevent me from getting a winmain16@ error?
I am unsure as to what `__cpu_features_init' means or how i fix it
This is my script and im wondering if everything is set up correctly like my #includes.
include <windows.h>
include <gl/glu.h>
include <stdlib.h>
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static HGLRC hRC;
static HDC hDC;
Here are my linker errors.
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Stranded\OGL.cpp" -o "C:\Stranded\OGL.exe" -I"C:\Dev-Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward" -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C:\Dev-Cpp\include" -L"C:\Dev-Cpp\lib" -lglu32 -lopengl32
/mingw/lib/crt2.o(.text+0x167):crt1.c: undefined reference to
__cpu_features_init' C:\Dev-Cpp\lib/libmingw32.a(main.o)(.text+0x106):main.c: undefined reference to
WinMain@16'collect2: ld returned 1 exit status
Execution terminated
I may have misled you rather. Most people it seems (I don't use it myself) use OpenGL through the GLUT toolkit (for which you need to download the library). Raw OpenGL however is supported already by in the Dev-C++ distribution. I would have told you that had I been aware of it - honest!
OpenGL is provided by the Windows operating system as a DLL. All you need to use it is an export library. If you are using raw OpenGL rather than GLUT, then you need do nothing more that link the libopengl32.a by adding the linker option -lopengl32. You have done that and resolved all your missing OpenGL references - now you have an entirely different problem unrelated to OpenGL.
Your code has no entry point. WndProc() is not a recognised entry point. On Win32 only main() and WinMain() are recognised entry points. WinMain() is used for Win32 GUI apps, and main() for console apps. OpenGL can be used in either, all the examples on the GLUT thread are written as console apps. The fundamental difference is that a GUI app does not display a console. It only displays anything if you tell it to (usually by creating a window). GUI apps are generally have more a more complex structure - having a Windows message processing loop. Your WndProc function would be called from such a loop. If you wish to write your program this way, and are not sure how to start, I suggest that you start your project using the Win32 GUI project template (File->New->Project), and the OpenGL library to the build, and insert your code into the WndProc function that the template provides.
The __cpu_features_init error is most often caused by mixing compiler, linker, and library from different and incompatible tool-chains. Maybe you screwed up your installation with the GCC 4.x attempt (perhaps I should never have mentioned it, I should have known better or realised that you wouldn't!).
This is compiled C programming BTW not scripting! It is not referred to as a script, merely code, source code or program. Scripting is done in scripting languages, C is not a scripting language. http://en.wikipedia.org/wiki/Scripting_language. I feel better now! ;-)
Clifford
Im guessing i cant have a MainWindowProc() as an Entry Point in Windows Applications?
in a differnt 'script'(corret me if im wrong plz) 1 of the errors i got were #include "CGfxOpenGL.h"
which is probably telling me to switch over to MVC++ :p
Anyways, heres the Compile Log for that Script.
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\Dev-Cpp\ATimetoKill\winmain.cpp" -o "C:\Dev-Cpp\ATimetoKill\winmain.exe" -I"lib\gcc\mingw32\3.4.2\include" -I"include\c++\3.4.2\backward" -I"include\c++\3.4.2\mingw32" -I"include\c++\3.4.2" -I"include" -L"lib" -lopengl32 -lglu32
In file included from C:\Dev-Cpp\ATimetoKill\winmain.cpp:8:
C:\Dev-Cpp\ATimetoKill\/CGfxOpenGL.h:1:1: unterminated #ifndef
C:\Dev-Cpp\ATimetoKill\winmain.cpp: In function
void SetupPixelFormat(HDC__*)': C:\Dev-Cpp\ATimetoKill\winmain.cpp:42: error: expected
}' before numeric constantC:\Dev-Cpp\ATimetoKill\winmain.cpp:42: error: expected
,' or
;' before numeric constantC:\Dev-Cpp\ATimetoKill\winmain.cpp: At global scope:
C:\Dev-Cpp\ATimetoKill\winmain.cpp:46: error: expected constructor, destructor, or type conversion before '=' token
C:\Dev-Cpp\ATimetoKill\winmain.cpp:46: error: expected
,' or
;' before '=' tokenC:\Dev-Cpp\ATimetoKill\winmain.cpp:47: error: expected constructor, destructor, or type conversion before '(' token
C:\Dev-Cpp\ATimetoKill\winmain.cpp:47: error: expected
,' or
;' before '(' tokenC:\Dev-Cpp\ATimetoKill\winmain.cpp:48: error: expected declaration before '}' token
Execution terminated
How about let's concentrate on one problem at at time!? This is an entirely different question, and probably therefore deserves a new thread. Have you resolved the first problem?
The first thing I would say is that C:\Dev-Cpp\ATimetoKill is not a good place to keep your project. Apart from being a generally bad idea to 'pollute' an application installation with user files, there is in fact a bug in Dev-C++ that in some circumstances prevents projects from building when in c:\dev-cpp or subfolders thereof.
>> which is probably telling me to switch over to MVC++
If this is someone else's code it may be true that it was intended for MSVC++, but unless it relies upon MFC or some other Microsoft specific technology it would be portable. Either way the error messages do not indicate that conclusion - have you actually bothered to read them and the code to which they refer? That is after all what they are for!
>> Im guessing i cant have a MainWindowProc() as an Entry Point in Windows Applications?
It is not my business to teach you Windows programming, but it is in your interest to at least get the fundamentals under your belt before you launch into OpenGL or any other advanced programming. You don't need to 'guess' anything! I told you exactly how to create a basic Windows GUI application framework. Don't insult be by not reading the advice you asked for.
>> CGfxOpenGL.h:1:1: unterminated #ifndef
Means exactly what it says. Let me guess, line 1 says something like:
ifndef __GL_COMPONENT
at the end of the file there should be a corresponding #endif. You don't need to know anything about Windows programming or OpenGL to figure that one out! Perhaps you failed to copy & paste the code completely?
With respect to the other the other errors, well you have the benefit of both the error log and the code but have only given us one of those, and I have done enough guessing. It seems as if you don't really want your problem solved! What do lines 42, 46, 47 and 48 look like? Actually you should probably post all the code up to line 48. If this is not your code, you might simply post a link to where you obtained it. Fix the #ifndef error first and try again first though (and post the new log with the code).
>> in a differnt 'script'(corret me if im wrong plz)
I already did, now you are just being perverse (and illiterate).
Clifford
yeah, #endif at the end of the CGfxOpenGL header file worked! As u knew it would? :)
I read again what u typed about WndProcedures not being valid Entry Points, i dont know how to create a Win32 GUI App in devcpp. You said File>New>Project but theres nothing that says GUI APP. There is a Standard Windows Application Icon, but thats what i have been using to type the code in.
if i type my code in a Win32 GUI APP i will not experience WinMain@16 errors?
hers the code,
define WIN32_LEAN_AND_MEAN
define WIN32_EXTRA_LEAN
include <windows.h>
include <gl/gl.h>
include <gl/glu.h>
include "CGfxOpenGL.h"
bool exiting = false;
long windowWidth = 1024;
long windowHeight = 768;
long windowBits = 32;
bool fullscreen = false;
HDC hDC;
// global poointer to the CGfxOpenGL fendering class
CGfxOpenGL *g_glRender = NULL;
void SetupPixelFormat(HDC hDC)
{
int pixelFormat;
3.
Compiler: Default compiler
Building Makefile: "C:\ATimetoKill\Makefile.win"
Executing make...
make.exe -f "C:\ATimetoKill\Makefile.win" winmain.o
g++ -I"lib/gcc/mingw32/3.4.2/include" -I"include/c++/3.4.2/backward" -I"include/c++/3.4.2/mingw32" -I"include/c++/3.4.2" -I"include" -c -o winmain.o winmain.cpp
winmain.cpp: In function
void SetupPixelFormat(HDC__*)': winmain.cpp:42: error: expected
}' before numeric constantwinmain.cpp:42: error: expected
,' or
;' before numeric constantwinmain.cpp: At global scope:
winmain.cpp:46: error: expected constructor, destructor, or type conversion before '=' token
winmain.cpp:46: error: expected
,' or
;' before '=' tokenwinmain.cpp:47: error: expected constructor, destructor, or type conversion before '(' token
winmain.cpp:47: error: expected
,' or
;' before '(' tokenwinmain.cpp:48: error: expected declaration before '}' token
make.exe: *** [winmain.o] Error 1
Execution terminated
Missing comma after PFD_MAIN_PLANE in pfd initialiser. Read the error messages! Here line 42 (the line after the error) makes no sense in the context of the missing comma. The compiler will not always be able to tell you where the error is, but rather where the code stopped making sense. You need to look it in that way.
Also the last comma in the initialiser:
0, 0, 0, // NO LAYER, VISIBLE, DAMAGE MASK
should not be there.
You cannot go through this being spoon fed, you have to learn to diagnose these simple errors yourself.
However see how quickly you get a solution what you post good information!?
> [...]Standard Windows Application Icon[...]
Yes that's the one. I do not have Dev-C++ installed on this PC so that was from memory ... sorry if that caused confusion.
The template code has a WinMain() function. You should not replace or modify it (at least not until you know what you are doing). It will call teh message handler procedure (probably called WndProc or similar), and that is where you place your code. Before you do nay of that have you tried building the unmodified template code just to be sure you can? If when you add your code it fails, you know it is something you did rather than a problem with the tool.
Clifford
so when i compile this, i get linker errors to the 'CGfxOpenGL.cpp' file which contains the BOOL and void varaibles.
almost of of the void 'varaibles' (if thats rght) are undefined references. there are no syntax errors in this file so i no the code is right.
I am wondering how i link the undefined references.
And the [Warning] error has to do with NULL); and i have no idea what to change to make that right.
but as for the linker errors. All of them are in the file CGfxOpenGl.cpp so do i link this file with -L and put it in a seperate folder?
Compiler: Default compiler
Executing g++.exe...
g++.exe "C:\ATimetoKill\winmain.cpp" -o "C:\ATimetoKill\winmain.exe" -I"lib\gcc\mingw32\3.4.2\include" -I"include\c++\3.4.2\backward" -I"include\c++\3.4.2\mingw32" -I"include\c++\3.4.2" -I"include" -L"lib" -L"C:\Dev-Cpp\Include\CGfxOpenGL.h" -lopengl32 -lglu32
C:\ATimetoKill\winmain.cpp: In function `int WinMain(HINSTANCE*, HINSTANCE, CHAR, int)':
C:\ATimetoKill\winmain.cpp:186: warning: passing NULL used for non-pointer converting 1 of `HWND CreateWindowExA(DWORD, const CHAR, const CHAR*, DWORD, int, int, int, int, HWND, HMENU*, HINSTANCE, void*)'
C:\DOCUME~1\Owner\LOCALS~1\Temp/ccKgcaaa.o(.text+0x44):winmain.cpp: undefined reference to
ChoosePixelFormat@8' C:\DOCUME~1\Owner\LOCALS~1\Temp/ccKgcaaa.o(.text+0x63):winmain.cpp: undefined reference to
SetPixelFormat@12'C:\DOCUME~1\Owner\LOCALS~1\Temp/ccKgcaaa.o(.text+0x182):winmain.cpp: undefined reference to
CGfxOpenGL::SetupProjection(int, int)' C:\DOCUME~1\Owner\LOCALS~1\Temp/ccKgcaaa.o(.text+0x248):winmain.cpp: undefined reference to
CGfxOpenGL::CGfxOpenGL()'C:\DOCUME~1\Owner\LOCALS~1\Temp/ccKgcaaa.o(.text+0x564):winmain.cpp: undefined reference to `CGfxOpenGL::Init()'
C:\DOCUME~1\Owner\LOCALS~1\Temp/ccKgcaaa.o(.text+0x591):winmain.cpp: undefined reference to
CGfxOpenGL::Prepare(float)' C:\DOCUME~1\Owner\LOCALS~1\Temp/ccKgcaaa.o(.text+0x59e):winmain.cpp: undefined reference to
CGfxOpenGL::Render()'C:\DOCUME~1\Owner\LOCALS~1\Temp/ccKgcaaa.o(.text+0x5ab):winmain.cpp: undefined reference to `SwapBuffers@4'
collect2: ld returned 1 exit status
Execution terminated
And heres the code up until line 186,
define WIN32_LEAN_AND_MEAN
define WIN32_EXTRA_LEAN
include <windows.h>
include <gl/gl.h>
include <gl/glu.h>
include "CGfxOpenGL.h"
bool exiting = false;
long windowWidth = 800;
long windowHeight = 600;
long windowBits = 32;
bool fullscreen = false;
HDC hDC;
// global poointer to the CGfxOpenGL fendering class
CGfxOpenGL *g_glRender = NULL;
void SetupPixelFormat(HDC hDC)
{
int pixelFormat;
The option you have:
-L"C:\Dev-Cpp\Include\CGfxOpenGL.h"
is nonsense. I went thorugh this at length in my post on 10 January. Read it again!
I'll say it again for the hard-of-thinking: -L is a linker option to specify a folder path that contains libraries.
To link an object file, you merely specify its path/filename on the command line. You cannot 'link' a source file (much less a header file!), you have to compile it first (or in the case of a header, #include it in a file that you are compiling.
To compile and link multiple sources in Dev-C++ you must use a project (File->New->Project...). You then simply add the .cpp or .c source files to the project (Project->Add file). You can add headers (and any other files) as well for ease of access for editing, but it makes no difference to how the code is built. When you do this Dev-C++ will compile and link each source file separately and link the generated object code.
Your log indicates that you are not using a project and certainly not compiling and linking CGfxOpenGL.cpp - it shows the direct compilation and linking of winmain.cpp only.
The warning is quite clear, you have passed NULL (which has pointer type) for a parameter of type DWORD (an integer type). You almost certainly intended zero (0) rather than NULL. If you copied this code from somewhere else it may be indicitive of the quality (or lack thereof) of your source material.
Clifford
This more or less looks like someone trying to jump into 3D programming with out knowing how to program. In order to be efficient at 3D programming you need to have some kind of clue as to what you are doing and IMO you don't. Also IMO you can not read as you seem to only take the things you want from a response. I would highly suggest you listen to Clifford as when it comes down to it he knows his stuff and is one of the best resources you may ever find.
Maybe read the responses several times to ensure you understand and comprehend what you are being told.
My hats off to you C for your patience with this topic.
:) yes i really do apprecitate mr.Cliffords help!
i did manage to fix three of the erros by adding -lgdi32 to the linker option.
i also changed both of the NULL's to (0) which fixed the error in line 186
but i still do not understand how to fix or 'define' the 'undefined references' for CGfxOpenGL terms.
it says `CGfxOpenGL::SetupProjection(int, int)' the '::' is not present in the project im compiling(winmain.cpp) but it is found in CGfxOpengl.cpp that i had compiled w/o errors earlier.