From: Jon <jk...@mu...> - 2002-10-29 20:20:39
|
Hi People, I've been knocking this around for awhile so I thought I'd see if any of you can see any obvious errors with this code I'm working on. I'm using Win32 code for handling the OpenGL window. As some of my routines have gotten long I wanted to split the WinMain.cpp (containing the Game loop, rendering routine, startup, shutdown, etc.) into different files. All I've done so far is put all the #includes, #defines, Windows handles, and function declarations into a file called WinMain.h and #include "WinMain.h" in WinMain.cpp. BUT, WinMain.h is also included in one of my other header files (3DModel.h). When I compile I get the link errors: 3DModel.obj : error LNK2005: "struct HWND__ * hWnd" (?hWnd@@3PAUHWND__@@A) already defined in WinMain.obj I'm confused because I used a code example off GameTutorials.com and he does exactly what I have described here and it works fine. Any clues?? Thanks, Jon Here's what the declarations basically look like:: WinMain.h --- #ifndef _WINMAIN_H #define _WINMAIN_H #include <windows.h> #include <stdio.h> #include <stdlib.h> .... extern HDC hDC=NULL; extern HGLRC hRC=NULL; ... int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow); LRESULT CALLBACK WndProc( .... ... #endif WinMain.cpp --- #include "WinMain.h" #include "3DModel.h" ... 3DObject.h -- #ifndef ..... #include "WinMain.h" .... #endif 3DObject.cpp --- #include "3DObject.h" |