#include

hi

I want to split my classes up into folders to keep them seperate
and have some order. I have added files from different directories
but the #includes don't work. I've tried

#include "..\PlugIns\SomeHeader.h"

but this does not seem to work.

I also tried creating new directories in the project and dropping
files in but on reopening the project they don't seem to be
there.

How can you package your classes into a hierarchy?

thanks
mjwilliamsonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mjwilliamsonAuthor Commented:
its ok i forgot an extra ..\

0
aphillipsCommented:

> I want to split my classes up into folders

I think you may be confusing creating "folders" in the Visual Studio FileView and creating folders on disk.

The Visual Studio "folders" are stored as part of the project (.dsp file) and have nothing to do with the location of the files on disk.  In fact files in the same folder can be located anywhere on disk, but are typically all in the same place as the project file.  You can find out the actual location of a source file by viewing its properties (rith-click it in the FileView and select Properties from the context menu).

> #include "..\PlugIns\SomeHeader.h"

This will work if the header file is in the sibling directory called "PlugIns" to the directory where the source file is stored.  However I suspect all your files are in the same place for reasons stated above so just use:

#include "SomeHeader.h"

If you are #include'ing a header file from another header file then the behaviour of compilers can vary but I think the C standard says that the path is relative to the path of the source file (ie the outer header file) that includes the file.

> I also tried creating new directories in the project and dropping
> files in but on reopening the project they don't seem to be
> there.

I have seen problems where files moved to a folder don't stay there but move back to the "Source Files" folder in early versions of Devloper Studio 6.  I suggest you install the latest service pack, since I have not seen this problem for a while.

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jadams117Commented:
You might want to edit the list of directories to search for include files. From the main menu go to 'Tools | Options...' and select the 'Directories' tab. You can then specify #include files relative to these locations. It is very useful if you want to move projects between different machines

Jad
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.