Skip to main content
GameDev.net gamedev.net
🔒 Locked

Problem with VC++

Started by bargasteh Apr 12, 2005 at 8:11 AM 6 replies 500+ views
Original Post
bargasteh
bargasteh
My friend gave me a project last week, program works fine in VC++, it compile and everything but the problem is when I want to add a new header file to it (*.h) it doesnt compile and it says: fatal error C1083: Cannot open include file: 'Collision.h': No such file or directory Error executing cl.exe. the file Collision.h is there and I can also see it in header section but when I include it in the main.cpp the above error comes up. is there any where in VC++ where it doesnt let you add new headers? or what do you think this error is ?
OpenGl + C++
Red Ant
Red Ant
How did you write the include directive? Something like this:

// file : blah.cpp#include "blah.h"// ...


normally assumes that blah.h resides in the same directory as blah.cpp. If this is not the case you may have to specify the path to blah.h relative to blah.cpp, like so:

// file : blah.cpp#include "../headers/blah.h"// ...

bargasteh
bargasteh
the include is just like yours: #include "blah.h"
but I will try another because I have another directory that holds, other header files.
I will come back with answer.
OpenGl + C++
methinks
methinks
Does the .h file actually have to be added to the project?
I know you don't need to if you call #include , but what about if you call #include "header.h"?
bargasteh
bargasteh
I am having the same error again, it is really annoying.

in my header file I have only one function, which i can also put it in main.cpp but I want to keep it seperate (when I put that function in main.cpp profram compile and work) but when I put it in a seperate header file then it doesnt work.
I included all the other header files into my new header file but still doesnt work. I am thinking maybe there is somewhere in VC++ where you can stop people from adding new header files ?!

What is the problem here guys ?

I have my own project, I can add any header file or delete any so its not something that I couldnt do before. the problem is only with this project ?!

Is it possible to include a *.cpp file in a header ? (i know its silly)
OpenGl + C++
Red Ant
Red Ant
bargasteh, maybe I didn't explain myself well enough (I'm not good at explaining). Which directory is your header in? Is it in the same directory as the file which includes the header? Because if you specify your include directive in double-quotes and without a relative path (like you did) then it has to be, I think.
Mike Bossy
Mike Bossy
It's possible that you don't have the project set to look in the right directory for the include file. Can you give us what your directory structure looks like on disk? And let us know what version of VC you're running?
bargasteh
bargasteh
Thank you for all your help, the problem was sorlved.
The problem was directory as you guys said.

thank you all
OpenGl + C++

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.