cancel
Showing results for 
Search instead for 
Did you mean: 

Can't include libraries in visual code studio

Manu_30
Visitor

Hello,

I try to do a little code for STM32F103 MCU using Visual Code Studio with STM32 VS code Extension.

I can generate and compile base code using STM32CubeMX importation feature.

But I'm stuck with adding external libraries to the project.

What i've done is to modify the "c_cpp_properties.json" file of the project to add the path to the library I want to use.

Here the current file :

 

{
    "version": 4,
    "configurations": [
        {
            /** 
             * ms-vscode.cmake-tools plugin should be installed.
             * 
             * It provides data for C/C++ plugin,
             * such as include paths, browse paths, defines, etc.
             */
            "name": "STM32",
            "includePath": [
                "lib/ssd1351"
            ],
            "configurationProvider": "ms-vscode.cmake-tools",
            //"intelliSenseMode": "${default}",
            "intelliSenseMode": "gcc-arm"
        }
    ]
}

 

 

But when I include the ssd1351.h header in the main.c file, it fail :

 

 

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "ssd1351.h"
/* USER CODE END Includes */

 

 

Can someone point me to the solution for including external libraries in an VScode project ?

Thank you

1 REPLY 1
Manu_30
Visitor

I finally found one solution :

I added the path to the "CMakeLists.txt" file located in "cmake" folder.

Anyway, if there is a better/more standard way to solve the problem, I'd like to know about it.

Thank you,

Manu