Jump to content
  • Advertisement

Archived

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

Da cobra

trying to split my main.cpp

This topic is 5337 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

I have a main file with functions like gameloop() & Gamerender() and I want to put these 2 functions into a new .cpp and a new .h file so first I have : gameloop.h with hresult gameloop() ; hresult gamerender() ; and my gameloop.cpp : #include "gameloop.h" hresult gameloop() { ... } hresult gamerender() { ... } is this the correct way?!? Because now I get the following errors : error C2146: syntax error : missing '';'' before identifier ''GameLoop'' error C2501: ''HRESULT'' : missing storage-class or type specifiers fatal error C1004: unexpected end of file found and are pointing to my .h file

Share this post


Link to post
Share on other sites
Advertisement
Is hresult defined in gameloop.h? If you're using windoze (and it's HRESULT type) you must #include <windows.h> before using the type.

If you're new to header files, you should read this.


[edited by - nonpop on April 11, 2004 9:47:35 AM]

Share this post


Link to post
Share on other sites
I think you mean HRESULT not hresult, which will be defined if you include windows.h in you header file. Also if you include that header in more the one file( ie you have #include "gamedata.h" in both main.cpp and monsters.cpp or whatever), you should add #pragma once on top of it, this prevents it from beeing compiled more than once, which could be a problem.

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!