Skip to content

WARNING:compdb.includedb:libmodbus/include/modbus.h: could not resolve header: "stdint.h" #25

Description

@gianmarcoodorizzi

Hello,

I am using Visual Studio Code with vscode-clangd extension, which reads a compile_commands.json file and sets up the project based on that.
I noticed, however, that it fails to recognize includes inside header files that do not have a corresponding source file:

'string' file not found

when including <string>.

Hence, I am using your tool.
My (simplified) project directory structure is as follows:

├── MyExe
├── Makefile
├── build
│   ├── compile_commands.json
│   └── src
│       ├── Module1
│       │   ├── Module1.d
│       │   └── Module1.o
│       ├── Module2
│       │   ├── Module2.d
│       │   └── Module2.o
│       ├── main.d
│       ├── main.o
├── libmodbus
│   ├── include
│   │   ├── modbus-rtu.h
│   │   ├── modbus-tcp.h
│   │   ├── modbus-version.h
│   │   └── modbus.h
│   └── lib
│       └── libmodbus.a
├── src
│   ├── Module1
│   │   ├── Module1.cpp
│   │   └── Module1.hpp
│   ├── Module2
│   │   ├── Module2.cpp
│   │   └── Module2.hpp
│   ├── config.h
│   ├── json.hpp
│   ├── main.cpp
│   ├── version.hpp
│   ├── zhelpers.hpp
│   └── zmq.hpp`

When issue the command, this is what I get:

$ compdb --trace -p build/ list > compile_commands.json
WARNING:compdb.includedb:libmodbus/include/modbus.h: could not resolve header: "stdint.h"
WARNING:compdb.includedb:src/Module1/Module1.hpp: could not resolve header: "zmq_utils.h"
WARNING:compdb.includedb:src/Module2/Module2.cpp: could not resolve header: "time.h"

The original compilation database contains a list of similar entries:

{
    "arguments": [
      "/opt/fslc-framebuffer/3.1/sysroots/x86_64-fslcsdk-linux/usr/bin/arm-fslc-linux-gnueabi/arm-fslc-linux-gnueabi-g++",
      "-mthumb",
      "-mfpu=neon",
      "-mfloat-abi=hard",
      "-mcpu=cortex-a9",
      "-fstack-protector-strong",
      "-D_FORTIFY_SOURCE=2",
      "-Wformat",
      "-Wformat-security",
      "-Werror=format-security",
      "--sysroot=/opt/fslc-framebuffer/3.1/sysroots/cortexa9t2hf-neon-fslc-linux-gnueabi",
      "-DSPDLOG_COMPILED_LIB",
      "-Wall",
      "-Wextra",
      "-pedantic-errors",
      "-Wno-psabi",
      "-std=c++17",
      "-Ilibmodbus/include",
      "-Isrc",
      "-c",
      "-MTbuild/src/main.o",
      "-o",
      "build/src/main.o",
      "src/main.cpp"
    ],
    "directory": "/home/user/git/project",
    "file": "/home/user/git/project/src/main.cpp",
    "output": "/home/git/project/build/src/main.o"
  }

while the modified one has:

{
  "directory": "/home/user/git/project",
  "command": "/opt/fslc-framebuffer/3.1/sysroots/x86_64-fslcsdk-linux/usr/bin/arm-fslc-linux-gnueabi/arm-fslc-linux-gnueabi-g++ -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/fslc-framebuffer/3.1/sysroots/cortexa9t2hf-neon-fslc-linux-gnueabi -DSPDLOG_COMPILED_LIB -Wall -Wextra -pedantic-errors -Wno-psabi -std=c++17 -Ilibmodbus/include -Isrc -c -MTbuild/src/main.o -o build/src/main.o src/main.cpp",
  "file": "/home/user/git/project/src/main.cpp",
  "output": "/home/git/project/build/src/main.o"
}

as well as entries for headers:

{
  "directory": "/home/user/git/project",
  "command": "/opt/fslc-framebuffer/3.1/sysroots/x86_64-fslcsdk-linux/usr/bin/arm-fslc-linux-gnueabi/arm-fslc-linux-gnueabi-g++ -mthumb -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/fslc-framebuffer/3.1/sysroots/cortexa9t2hf-neon-fslc-linux-gnueabi -DSPDLOG_COMPILED_LIB -Wall -Wextra -pedantic-errors -Wno-psabi -std=c++17 -Ilibmodbus/include -Isrc -MTbuild/src/main.o -c /home/user/git/project/src/zmq.hpp",
  "file": "/home/user/git/project/src/zmq.hpp"
}

Is there something wrong with what I am doing here? Thank you in advance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions