User forums > Using Code::Blocks

Path of headerfile

<< < (2/2)

Jenna:

--- Quote from: Gerd on May 09, 2013, 01:24:38 pm ---Thank you for the comment.

I'm just wondering why this is a default behaviour.
Wouldn't it make sense to add -iquote $(PROJECT_DIR) by default?

--- End quote ---
I don't thinks so.
We have a similar setting: "Settings -> Compiler -> [your compiler] -> Build options -> Explicitely add project's toplevel directory to compiler search dirs".
But this does not find headers in subfolders like "include", neither does "-iquote $(PROJECT_DIR)".

scarphin:

--- Quote from: jens on May 09, 2013, 01:52:05 pm ---But this does not find headers in subfolders like "include", neither does "-iquote $(PROJECT_DIR)".

--- End quote ---
I'm not sure what you meant here but what I meant was, if one uses 'iquote' with his/her main project directory and have the header file in 'project_dir/include' and source file in 'project_dir/src' then (s)he can include the header file in source file like "include/header.h" instead of "../include/header.h".

oBFusCATed:
I think this should work by default, because the current working dir for running the compiler is the $(PROJECT_DIR).
I've never added that option and includes relative to the root of the project work as expected.

scarphin:
Then you must have some setting different cuz it doesn't work here. I do really want to know how you manage that as I don't want to use that option too.

Just to be sure, what you are saying is, you have include files in 'root/include' and sources in 'root/src' and you include with plain simple '#include "include/someheader.h"' and everything works as expected?

oBFusCATed:
I think yes...

Navigation

[0] Message Index

[*] Previous page

Go to full version