cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeIDE won't let me add an external library (Noob Question)

MGall.6
Associate II

HI everyone,

As an absolute beginner to STM32, I purchased a Nucleo STM32F411 board.

I'm currently trying to use an online MPU9250 library I found on the internet through: https://github.com/talhaSr/mpu9250

When I tried to import the header and source files into the project, the compiler still cannot find the "mpu9250.h" header file that I manually linked to the list of "includes" and "source".

For reference, here's what I've done so far:

Original Error = stm32_error.png

STM32 Includes = stm32_includes.png (Note the same path is linked to C++ as well)

STM32 Source = stm32_source.png

Could someone please explain if I did anything wrong, or maybe a step by step tutorial?

6 REPLIES 6
TDK
Guru

You're compiling a C++ file, but the includes that are shown are for C files. There is a different tab for C++ includes.

If you feel a post has answered your question, please click "Accept as Solution".
MGall.6
Associate II

Sorry, I shouldv'e been clearer in my initial question. I linked it for both C and C++ just in case I needed them both.

TDK
Guru

Not real sure.

Are these same directories also listed in C/C++ Build -> Tool Settings -> MCU GCC(and G++) Compiler -> Include paths?

The actual compile command shown in the console used to compile should also show what include directories were used to compile.

If you feel a post has answered your question, please click "Accept as Solution".
MGall.6
Associate II

Hi TDK,

I tried to find out the bits of info you mentioned, they're in the attached image (only one upload allowed I think).

TDK
Guru

Hmm, I'm not sure what's going on. There has to be a reason it's failing but I can't spot it.

You could always move those files into the Core/Src and Core/Inc directory and build it without needing to add include paths.

If you feel a post has answered your question, please click "Accept as Solution".
MGall.6
Associate II

I finally figured out the issue. I had included the links to those files in the MPU9250 folder, instead of the actual files themselves (I chose the "link files") option.