Can't compile multiple file projects in Code::Blocks!

I'm having an annoying issue with Code::Blocks when I try to include a header file I made containing a class definition into a .cpp file that implements the classes member functions. The issue is whenever I try to compile my program I get an error saying the header file doesn't exist, even though the file is part of the project and in the same directory as the rest of the program.

I don't believe I'm missing any code because even when I add a class using Code::Blocks Class wizard to generate the code for the class definition and its corresponding .cpp file it still causing the same error.

Here's the code for the header file and .cpp file:

.h

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#ifndef TEST_H
#define TEST_H


class Test
{
   public:
      Test();
      virtual ~Test();
   protected:
   private:
};

#endif // TEST_H 


.cpp

1
2
3
4
5
6
7
8
9
10
11
#include "Test.h"

Test::Test()
{
   //ctor
}

Test::~Test()
{
   //dtor
}


The error points to the first line of the .cpp file (#include "Test.h") with the message: "fatal error: Test.h: No such file or directory". I'm using the GCC compiler which I downloaded seperatly from Code::Blocks.
Please check if both were in the same directory, so they find each other.
I figured it out. It was because when I added the files to the project I clicked on "Add file to active project in build target(s)" but I didn't select the actual build target.
-please mark this topic as solved then-
Last edited on
Topic archived. No new replies allowed.