News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Use directory relative to source file directory in Search Directory

Started by J-No, August 26, 2021, 05:02:48 PM

Previous topic - Next topic

J-No

Hello everyone,

I have a codeblocks project with severals sources directories, like this structure:

<Project dir>\Dir 1\Dir 1.1\sources
                                        \includes
                             Dir 1.2\sources
                                        \includes

When I compile src files from one sources directory, I want to add dedicated includes dir in search dir.

I try to use in Search directories project $(file_dir)..\includes, but when I compile $(file_dir) is empty (not visible).
I know it is possible to add in -I$(file_dir)..\includes in Command line macro, but I want to use this feature only with my Workspace /Project.

How to do that ?

Thak you for your help

BlueHazzard

I am not 100% sure what you are asking for, but you can add include directories in Project->Build options->Search directories->Compiler
this paths are relative to the project path


You can always work relative to your source file,
if you want to include a.h in a.cpp

Dir1\Dir1.1\sources\a.cpp
                 \includes\a.h

you can simply write
#include "../includes/a.h"