Linking/compiling a header file

I have two cpp files, one with the main code in and one with the definition of a class and its member functions. The class is declared in header file.

When I set the properties of the header file to 'compile' and 'link' it doesn't work, Codeblocks first says "It appears the project has not yet been built. Would you like to build it now?" and then after I click yes it doesn't compile or run, but gives an error.

However, when I uncheck the 'compile' and 'link' boxes for the header file, everything works fine.

Why is this?
Normally, you just need to add both solutions to the source file without any extra "Linking" as that is normally handled automatically by the IDE (I think code::blocks does this too). Manual linking only needs to be done for external libraries.
Topic archived. No new replies allowed.