Member Avatar for majorawsome

I am using Code::Blocks as my IDE and I am creating a text based game (Not very complex as I am just starting out with c++). As I proceed through this project I have found it more orderly to have multiple cpp files within a folder that relate(like two cpp files will have all of one header).

header HEADER - 
void goesInAFile();
void goesInAnotherFile();    

HEADER

OneCPPFile
void goesInAFile() {}

First cpp file

SecondCPPFile
void goesInAnotherFile() {}

Second cpp file

and OneCPPFile and SecondCPPfile go into a sub folder.
so its like

PROJ
-FILES
--header HEADER
--HEADER CPP FILES
---OneCPPFile
---SecondCPPFile

Recommended Answers

All 3 Replies

So is there a problem you need help with?

Member Avatar for majorawsome

in my IDe i have 2 files in a seperate folder but they wont let me acccess the folder above it where the header is.
Sorry I was rushed to get the example of what it lookes like out i forgot to put my problem in the main statement. lol

Member Avatar for majorawsome

I was able to find the answer. If you want to create a project with multiple folders and you want to have other headers access them just use
#include "../HEADER.H"

With this the two ".." before the / means to go up one folder.
If you are still confused please see here
http://stackoverflow.com/questions/5134357/how-to-include-header-files-in-other-src-folder
It is the first answer. I also believe that this explains it better than I did here so see this example.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.