Member Avatar

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();    


void goesInAFile() {}

First cpp file

void goesInAnotherFile() {}

Second cpp file

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

--header HEADER

Recommended Answers

All 3 Replies

So is there a problem you need help with?

Member Avatar

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

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
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, learning, and sharing knowledge.