We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,716 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Include header file in project - Code::Blocks

I've created a new class called BulletList2(linked list) using the built in dialog(File>New Class) which created a header file called bulletlist.h (in project folder>include) and a source file called bulletlist2.cpp(in project folder > src).

header file

#ifndef BULLETLIST2_H
#define BULLETLIST2_H


class BulletList2
{
     [...]
}
#endif // BULLETLIST2_H

In class and main file

#include "bulletlist2.h"

I get this error:
fatal error: bulletlist2.h: No such file or directory|
||=== Build finished: 1 errors, 0 warnings ===|

I'm using Ubuntu Natty Narwhal 64-bit and Code::Blocks installed from Software Center

2
Contributors
3
Replies
5 Hours
Discussion Span
1 Year Ago
Last Updated
11
Views
Question
Answered
Epicurus
Newbie Poster
12 posts since Sep 2011
Reputation Points: 27
Solved Threads: 0
Skill Endorsements: 0

Code::Blocks normally puts all *.h and *.cpp files in the same folder as the project itself. If you move those files somewhere else you will have to tell CB where to find them.

Ancient Dragon
Achieved Level 70
Team Colleague
32,116 posts since Aug 2005
Reputation Points: 5,836
Solved Threads: 2,575
Skill Endorsements: 68

'src' and 'include' are subfolders in my project folder and I didn't move anything, they were placed there by the wizard

Epicurus
Newbie Poster
12 posts since Sep 2011
Reputation Points: 27
Solved Threads: 0
Skill Endorsements: 0

Finally found a solution: Coding Explorer @Wordpress - CodeBlocks Failed to Find the Header File

You have to go [Project>Build options>Search directories>Add>correct folder>] and include both the /src/ and /include/

Epicurus
Newbie Poster
12 posts since Sep 2011
Reputation Points: 27
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 1 Year Ago by Ancient Dragon

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0648 seconds using 2.72MB