Jump to content
  • Advertisement
Sign in to follow this  
Nokame

This is truely a beginners question

This topic is 4267 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've been trying my luck at writting a 2d game in directdraw, and the file is getting too large... i want to add my own header files and other source files... i'm useing visual studio 6 so visual c++ 6... i added a header file called game.h to my project and copied some globals and structures in there.. then on the C++ file i added #include "game.h" and i get the error that game.h can't be opened because file or directory doesn't exist... and another note... the game.h file is in the same directory as my project... any help would be appreciated greately.

Share this post


Link to post
Share on other sites
Advertisement
Throw up a screenshot of VS open along with an explorer window showing your code. That, I'd think would be the best way to help us help you.

Share this post


Link to post
Share on other sites
Quote:
Original post by ForeverNoobie
did you forget to save the game.h file by chance?


Most likely if he's a beginner, he didn't modify Visual C++ and it should save every time you try to compile (this can be a curse or blessing, depending how you look at i).

When you mean its in the same directory as your poject, is it in the same directory as the actual workspace file? If you created a workspace in directory C:\Foo, and your project is in C:\Foo\Bar, you'll want to #include "BAR\game.h". It wouldn't matter that you included the header file into your project, as it wouldn't be looking there.

If that isn't the case, then you could under worst case scenarios, is under the settings to visual studio, tell it to use that directory for includes.

Share this post


Link to post
Share on other sites
I'd suggest getting MSVC++2005 as well. It's free for life, from Microsoft. Keep in mind MS dropped support for version 6.0 with Direct3D a while ago (although DirectDraw itself, which is part of Direct3D, shouldn't experience any problems). And version 6.0 is far less standards compliant. And 2005 is just way better.

Share this post


Link to post
Share on other sites
yeah it saves when i compile, i figure it will be fine for now doing that, and it is also in the same folder as my workspace. :) any other ideas? i'll try the settigns and see if i can include it there.

Share this post


Link to post
Share on other sites
Okay... here is the deal... i have a folder with my source code and my bitmaps and the game.h file. I also rightclicked my Header Files and added the game.h to the workspace... do i have to do anything else... i mean i obviously must be missing something because the compiler error says it can't find the file... so do i have to officially insert it into the project? or change some settings around?

Share this post


Link to post
Share on other sites
You shouldn't need to add it in your project but it is a good idea too.

Are you including like this:

#include <game.h>

or this

#include "game.h"

because the way you should be doing it is the second way

#include <game.h> would look in your include paths which I bet doesn't include your project directory. (However, I am not sure that once it finishes looking in the include paths, it will look in the current directory)

#include "game.h" would look in the directory where your project is located.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!