Skip to main content
Associate
March 25, 2024
Question

How to add Eigen library C++ to STM32CUBEIDE

  • March 25, 2024
  • 3 replies
  • 4617 views

Hi, 

I need help with instructions how I add the Eigen library C++ library to an STM32CUBE IDE project. I have created a project with no target for simplicity, using C++ as the basis language. I have downloaded the open source Eigen C++ library which supports matrix calculations. But I am having difficulties how to add it to the STM32 project. 

Can someone who has used this library with STM32 Cube, help with instructions how I can add it please ? 

1 - I created a foder lib under my project explorer, and copied the Eigen library to this folder (as shown in the attached picture pic1)

2 - I added the path to eigen lib in both the includes and source locations in the paths and symbols. (pic2)

When I build the main.cpp as it is first, I get a lot of errors. 

Can Anybody help by giving instructions how i add this library? 

 

I am attaching my project to this post too.

 

 

3 replies

Rim LANDOLSI
ST Employee
March 26, 2024

Hello @Bachir  and welcome to the community,

This knowledge base article may help you link an external library to the STM32CubeIDE project.

Hope this helps you!

Thanks,
Rim.

mikewhooo
Explorer II
November 16, 2024

I hope this message finds you well. I wanted to follow up and ask if you were able to resolve the issue you mentioned regarding the Eigen library. I am encountering the same problem, where it keeps showing an error about a missing main.h file.

Any help or insights you could provide would be greatly appreciated!

Pavel A.
Super User
November 16, 2024

Looks like you include some test programs into the library and these programs have their own main. You don't want these test modules in the library.

 

mikewhooo
Explorer II
November 20, 2024

Thank you all, I have resolved the C/C++ programming issue. To use Eigen, simply copy the Eigen folder into your project and include `<Eigen>` to use it. When creating a new `.cpp` file, you need to rename `main.c` to `main.cpp`, and all other `.c` files you wrote should also be renamed to `.cpp`.