LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Multiple source files and headers in a Code::Blocks project. How? (http://www.linuxquestions.org/questions/programming-9/multiple-source-files-and-headers-in-a-code-blocks-project-how-902447/)

searching_for_answers 09-11-2011 10:58 AM

Multiple source files and headers in a Code::Blocks project. How?
 
I have a project consisting of two source files, main and class, and a header with class declaration so I wrote #include "headername.h" in the two source files. Now I get this error:
fatal error: headername.h: No such file or directory|
The header and class was created using the build in wizard(file>new class) and the two files are in the project folder under /include/ and /src/. I've been told that this has something to do with GCC but I don't know if that's true.

I'm using Ubuntu Natty Narwhal 64-bit with Code::blocks installed from the software center.

ta0kira 09-11-2011 12:19 PM

I don't know Code::Blocks, but if gcc is the compiler you need to find a project setting that sets the "include" directories. gcc needs to know to look in the "include" subdirectory. "fatal error" doesn't look like a gcc error, though, so maybe it's from some other program in the build chain.
Kevin Barry

searching_for_answers 09-11-2011 12:53 PM

The solution can be found here Coding Explorer: CodeBlocks Failed to Find the Header File

You were right ta0kira, I had to do something about these sub directories. In case that link disappears and anyone else finds this thread you have to go: [Project>Build options>Search directories>Add>correct folder>] and add the /src/ and /include/ folders


All times are GMT -5. The time now is 03:16 AM.