Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Livecoma

Some help with my program structure and tutorial 1 please.

This topic is 6296 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I went through NeHe''s first tutorial on creating a GL window. After I finished it I decided to change the structure a bit to make it easier to understand for me, and here is what I''m trying to do... I put the CreateGLWindow, DrawGLScene, InitGL, KillGLWindow, and ReSizeGLScene functions all in separate .cpp files and added them to my project. I put the WndProc and WinMain functions into a file called WinMain.cpp, and I added that to my project also. After that, I created a header file(globals.h) to contain all the includes,(windows.h, glu.h, etc...) globals, and function prototypes. I then added this file to my project, and #included it in all my .cpp files. When I go to link I get a bunch or errors saying something like "already defined in whatever.obj". Here is the globals.h file. Please give me some advice I can''t firgure this one out, but if it turns out to be a dumb mistake I appoligise. //--------------------globals.h-----------------------// #if !defined NO_DUPE_CODE #define NO_DUPE_CODE #define WIN32_LEAN_AND_MEAN #include #include #include #include extern HGLRC hRC = NULL; extern HDC hDC = NULL; extern HWND hWnd = NULL; extern HINSTANCE hInstance; extern bool keys[256]; extern bool active = TRUE; extern bool fullscreen= TRUE; LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); GLvoid ReSizeGLScene(GLsizei width, GLsizei height); GLvoid KillGLWindow(GLvoid); int InitGL(GLvoid); int DrawGLScene(GLvoid); BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag); #endif //----------------------end of globals.h----------------//

Share this post


Link to post
Share on other sites
Advertisement
Check out Nehe''s new basecode floating around his news section. It''s very organized and split into a couple files and headers

Share this post


Link to post
Share on other sites
Thanks for the reply. I just fixed it myself though yay! I''m going to check it out for comparison though.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!