News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

Including header files

Started by LordCB, March 05, 2010, 04:12:14 PM

Previous topic - Next topic

LordCB

Hello Friends,

I have a stranges problem. During coding I add a  class with header and implementation.
So the headerfile in folder "header" and the implementation in the "src" folder.

So my include for the header looks like
#include "header/project.h"

and then... compilation
I get this

X:\path\to\my\project\src\project.cpp|32|error: header/project.h: No such file or directory|


what wrong here? I look in the cbp file and the files are correct placed in my oppinion


<Unit filename="header\project.h" />
<Unit filename="header\stringtable.h" />
<Unit filename="header\tokenizer.h" />

stahta01

Add an search directory for the current project folder or the "src" folder.
Or, check mark the the place in project settings where it does that.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

LordCB

Adding the projectfolder do the trick?!?!?!

When I have a project open, why should I add the the Projectpath to itself.???

MortenMacFly

Quote from: LordCB on March 05, 2010, 04:44:34 PM
When I have a project open, why should I add the the Projectpath to itself.???
Because your project file can be anywhere.
It's probably misleading, but it's not the project path that you have to add, but the path where "header" is the sub-path. In your case it's most likely the project path.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

LordCB