Author Topic: Including header files  (Read 5618 times)

Offline LordCB

  • Multiple posting newcomer
  • *
  • Posts: 79
Including header files
« on: March 05, 2010, 04:12:14 pm »
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
Code
#include "header/project.h"

and then... compilation
I get this
Code
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

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

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7790
    • My Best Post
Re: Including header files
« Reply #1 on: March 05, 2010, 04:16:48 pm »
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++ and Git.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline LordCB

  • Multiple posting newcomer
  • *
  • Posts: 79
Re: Including header files
« Reply #2 on: March 05, 2010, 04:44:34 pm »
Adding the projectfolder do the trick?!?!?!

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

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9723
Re: Including header files
« Reply #3 on: March 05, 2010, 04:51:06 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: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline LordCB

  • Multiple posting newcomer
  • *
  • Posts: 79
Re: Including header files
« Reply #4 on: March 05, 2010, 09:13:46 pm »
Ok thanx a lot ;o)