LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-11-2011, 10:58 AM   #1
searching_for_answers
Member
 
Registered: Sep 2009
Location: Sweden
Distribution: Mandriva
Posts: 44

Rep: Reputation: 21
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.
 
Old 09-11-2011, 12:19 PM   #2
ta0kira
Senior Member
 
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
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

Last edited by ta0kira; 09-11-2011 at 12:20 PM.
 
1 members found this post helpful.
Old 09-11-2011, 12:53 PM   #3
searching_for_answers
Member
 
Registered: Sep 2009
Location: Sweden
Distribution: Mandriva
Posts: 44

Original Poster
Rep: Reputation: 21
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
 
  


Reply

Tags
codeblocks, gcc, header



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] how to add some compiler flags in code blocks IDE for Mysql headers and APIs golden_boy615 Programming 3 07-16-2011 01:57 AM
[SOLVED] how to add some compiler flags in code blocks IDE for Mysql headers and APIs golden_boy615 Programming 2 07-14-2011 12:47 AM
LXer: How-To: Compile and Install Code::Blocks from Source in Debian Lenny LXer Syndicated Linux News 0 01-12-2009 09:40 PM
using multiple source code files hoshangi Programming 7 12-12-2007 01:07 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration