Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 187
  • Last Modified:

#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
0
mjwilliamson
Asked:
mjwilliamson
1 Solution
 
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
 
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

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now