#include and alternate directories
I'm programming several apps at one, and I find I'm using the same class files and includes in all apps.
For example, I have a file Character.cpp that contains the class Ccharacter. I'm using this file in all four apps, and I want to only have one copy that all four projects can reference. So I created a directory in the same level as the apps called "Shared Resources".
Problem is, my includes are now being confused because it can't find the files. I've tried going into configure project and adding the directory to the Additional Include Directories, but that doesn't make a difference.
What do you pros do?
Re: #include and alternate directories
For directories that hold custom headers.....utility classes and such...I use project settings...C++.....preprocessor.....Additional include directories (VC6). As long as I have not used relative paths when I put the includes in the project specific files this works for me.
Re: #include and alternate directories
Did you tried to add the relative path in the include item ?
Re: #include and alternate directories
I have, and it works, but I'd like to avoid having to do that. I managed to get around it. For some reason, Visual Studio's project settings don't work for this, but the compiler one's do. Very odd, but I'll take it!
Re: #include and alternate directories
Do you use source safe?
If you do, then you can do what I do.
I just share the cpp files in source safe, so they are linked to each other.
IE: Under the projects in source safe I might have
Project Alpha
Project Beta
Under each I might have MyTools.cpp
MyTools.cpp is shared between them, so it is actually the same exact source file. If I make a change to MyTools.cpp in Project Alpha, it also gets changed in Project Beta.
I also have a project that is called Common Objects that I put all my commonly used objects in. Whenever I make a new project, I then just share from that common objects directory and I can pick whatever objects I want from it.
The advantage of this method over creating a common directory on your computer is that each project remain portable and does not have any kind of required directory structure. Anybody can just select any project from source safe, and then pick any working directory they want, do a Get Latest and load the project with dev studio without any kind of custom settings in dev studio such as additional include and source paths.
Re: #include and alternate directories
The others are right, it's probably that your project is still expecting to find them in the current directory. Try removing them from the project, then adding them (Add Existing Item) back in from the new directory.