Nightmare with include paths

General questions regarding the usage of CodeLite
LuzPoder
CodeLite Curious
Posts: 2
Joined: Tue Jul 02, 2024 11:43 pm
Genuine User: Yes
IDE Question: C++
Contact:

Nightmare with include paths

Post by LuzPoder »

Hello everyone!

I am using Codelite 17.9.0 to program C and I got a problem with the directive #include

As you can guess from the title, I am starting with the IDE, and during my lessons at university I used the paths given by my teachers, because they explained modularity, but not how to setup the include paths!

I got myself a library from github and I am compiling all my code successfully, only I can not add it to my main.c

The absolute paths to my project are a follows:
Workspace: C:\Users\LuzPoder\Documents\CodeLite\TestingModbus
Project with my main.c: C:\Users\LuzPoder\Documents\CodeLite\TestingModbus\TestingModbus
Project containing the headers I want to include: C:\Users\LuzPoder\Documents\CodeLite\TestingModbus\libmodbus-master

So, I go to the TestingModbus project, right click, Settings -> Compiler -> Include Paths. There, I write this:

.
../libmodbus/src
./libmodbus/src
/libmodbus/src
libmodbus/src
../libmodbus/

Yeah, as you can see, I am desperate at this point 😅 Been trying two weeks after work, checked the old files from my teachers and tried copying the same stuff, used #include with "" and also with <> but nothing is working...

LuzPoder
CodeLite Curious
Posts: 2
Joined: Tue Jul 02, 2024 11:43 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Nightmare with include paths

Post by LuzPoder »

I found the anser myself. There are two solutions, if it helps anyone:

Relative path:
..\libmodbus-master\src

Absolute path:
C:\Users\LuzPoder\Documents\CodeLite\TestingModbus\libmodbus-master\src

It turns out that I was using the wrong slash / while I should have used the \ slash...
My keyboard is Spanish and this second slash is located in an unconvenient location. Plus, for any reasons the / slash was working during the practices that my teacher sent me.

Post Reply