Posted on 2003-03-18
Medium Priority
Last Modified: 2013-11-20

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

How can you package your classes into a hierarchy?

Question by:mjwilliamson
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Author Comment

ID: 8161361
its ok i forgot an extra ..\


Accepted Solution

aphillips earned 100 total points
ID: 8164648

> 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.


Expert Comment

ID: 8170695
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


Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I found this questions asking how to do this in many different forums, so I will describe here how to implement a solution using PHP and AJAX. The logical flow for the problem should be: Write an event handler for the first drop down box to get …
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question