Code Blocks won't recognize the header for the class it wrote?

11,066

Solution 1

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

http://codingexplorer.wordpress.com/2011/03/20/codeblocks-failed-to-find-the-header-file/

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.

Cheers

Solution 2

should go to here in toolbar: Project/Build Options/search directories now using the address of "include" folder,where headers are put usually there,add it. This way a header can be included.

   #include "header.h" 

Solution 3

I had the same issue, i guess all i could do is to save and close the project and then re open it again and it worked fine, but i guess there should be a faster way to fix this issue. any way try what I've told you if you're desperate :)

Share:
11,066
George Bora
Author by

George Bora

My interests are: Artificial Intelligence Design Patterns OOP Web Programming Java C# JavaScript XML My personal interests are: Tai Chi History Geology

Updated on June 04, 2022

Comments

  • George Bora
    George Bora almost 2 years

    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?

  • McCormick32
    McCormick32 about 9 years
    Thank you for this. I have been trying to figure out how to point to a specific folder and all I could find is suggestions to include the entire path to the directory in my #include line.