I am on Windows, and I am developing an ARM MCU project, so it's a cross-platform project, and it's makefile-based. I try to use msys2/mingw to create my vim IDE. I succeeded installing coc.nvim and coc-clangd and all their requirements, and I use compiledb
to generate compile_commands.json
for my project. But it seems coc.nvim cannot find header I include in my source code. For example, I include the header main.h
in main.c
, and coc.nvim complained main.h file not found [clangd:]
, also, for struct defined in header, coc.nvim complained 'unknown type name XXX [clangd:]'. Is there anyone here could help me debug this problem?
Here is the part of compile_commands.json related to main.c
{
"directory": "/c/Users/XXXX/Desktop/XXXX_project",
"arguments": [
"arm-none-eabi-gcc",
"-c",
"-mcpu=cortex-m7",
"-mthumb",
"-mfpu=fpv5-d16",
"-mfloat-abi=hard",
"-DUSE_HAL_DRIVER",
"-DSTM32F765xx",
"-IInc",
"-IDrivers/STM32F7xx_HAL_Driver/Inc",
"-IDrivers/STM32F7xx_HAL_Driver/Inc/Legacy",
"-IMiddlewares/ST/STM32_USB_Device_Library/Core/Inc",
"-IMiddlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc",
"-IDrivers/CMSIS/Device/ST/STM32F7xx/Include",
"-IDrivers/CMSIS/Include",
"-O0",
"-Wall",
"-fdata-sections",
"-ffunction-sections",
"-g",
"-gdwarf-2",
"-MMD",
"-MP",
"-MFbuild/main.d",
"-Wa,-a,-ad,-alms=build/main.lst",
"Src/main.c",
"-o",
"build/main.o"
],
"file": "Src/main.c"
},