C++ – Code Blocks won’t recognize the header for the class it wrote


I'm currently writing a small class to implement the Smith-Waterman algorithm in C++ in Code Blocks 10.05 on Ubuntu 11.10, although I ran into the exact same problem on CodeBlocks on Windows, I added a class with the new class option and it seemed to generate valid .h and .cpp files.

But when I try to compile in smithwaterman.cpp it gives me an error on the line it wrote that #include "smithwaterman.h" saying it can't find the file.

I can clearly see the file in the project at include/smithwaterman.h and I've tried to put the include/ but it doesn't help, if I included it with it's full path then it sees it but it seems like a very inelegant solution and right after that CodeBlocks blocked the .h file and I couldn't edit it.

Also after finishing that dialog box which lets me define the class it asked me if I want to include it in both bin and debug and I said yes.

Has anyone encountered this sort of problem before?

Best Solution

Check out this link. It helped me out a lot with the same problem.


Make sure when you add a folder to the search directory that the header and implementation file that you wish to include are in that folder, i.e. not in a folder within that folder.