2025-01-09 05:52 AM
Hello!
One problem I had today:
I made a new project for one specific question.
In the process of doing this, I created a file. Let's call it test.c / test.h using STM32CubeIDE, V1.7, Linux.
To start from the beginning, I added a source folder, and created a h file and c file in this folder (test.c / .h)
I added include "test.h" in main. The compiler doesn't' find test.h.
Is there anything else to do? The folder I created has a small C in its icon, which indicates it's recognized
as a source folder, so I don't get it...
Thanks for any hint!
PG
2025-01-09 06:55 AM
To have it find test.h when you #include it, add the folder to the include directories in project properties:
To add a folder with source code that it needs to compile, add that folder in the "Source Location" tab shown in the screenshot.
2025-01-09 07:57 AM
Can be many reasons. But anybody would need more info to help you.
A) you have an STM32CubeIde project AAA created with STM32CubeIde - correct?
B) than you have a tree structure, a main.c file in some src directory - correct?
C) you have added to src directory some files, test. c and test .h - ok?
D) IDE indexes files - use command refresh.
E) now you must say to compiler where .h file are - go to properties, compiler, include files dir and add src directory. - solved?
For your reference:
I strongly suggest to include step by step description on how you got to critical point - if eveybody is able to recreate from SCRATCH (this is vital) the problem somebody could help you:
1) describe the steps you did, one by one;
2) try yourself to replicate the problem executing your steps one by one
2025-01-09 05:06 PM
Hello!
Thanks for your reply.
I'm sure I did it. I remember this folder. In short, here is the process (I will redo it while writing).
Just before you ask: I have the latest version of STM32CubeIDE (V 1.17.0) and I'm using Linux Ubuntu
V24.04.1 LTS.
Meantime, I found the solution while writing this message:
Just in case somebody has the same problem: I'm working with C++, and therefore I have setup the
path in GNU C++., like this:
Select project (in project explorer), right-click ->Properties, then go to C/C++ general and add the path.
Now the files are found.
Thanks for the replies anyway.
There is another error, but this will be another thread. See you there.
Best regards,
PG
2025-01-09 05:26 PM
> Select project (in project explorer), right-click ->Properties, then go to C/C++ general and add the path.
This is what I said to do, no?
Except test.c is a C file, not C++.