2021-06-27 05:31 PM
I have a folder that contains two subfolders, 'inc' and 'src' which have header and source files respectively. I have a new project created with CubeMX for a nucleo board with all initial peripheral settings set.
How do I include the folder as mentioned so that when i include all the header files from the driver in main.h it recognises it as i've tried doing this before and kept getting met with errors 'no such file found' etc. ?
2021-06-28 02:06 AM
Hello @ZHama.1,
you can put your files in the folders "inc" and "src" of the generated project (the project that you generate with CubeMX), so you can call them easily without any problem.
Or you can add the path of the folder that contains the two subfolders to you project, for example in keil go to :
option for target -> C/C++ -> Include Paths:
in the screen below
Click on the button in the red rectangle then add your path.
Mohamed Aymen.
2021-07-02 02:57 PM
I've attached a screenshot.
I have all the driver header and source files in inc and src within the 'POWERSTEP01' folder inside the driver folder as seen on the left. On the right in the project paths includes, ive added the path to the inc folder so all the source files can call on the header files. Yet for some reason when I build the project, one of the source files powerstep01.c cannot find the powerstep01.h file as shown in the console at the bottom of the screenshot. This happens for the other files too but its not shown as the build is paused after powerstep01.c
Why is this happening and how do i fix it?
2021-07-02 03:19 PM
>>Why is this happening and how do i fix it?
Because your paths are not helping the compiler find the files. You might need multiple if you #include "" from different levels/depths, because it's going to be relative to where the source file is
Perhaps use an equivalent path in the "include paths" so it can find it based on where the makefile runs from?
../Drivers/POWERSTEP01/inc ??