简体   繁体   中英

clang-tidy bundled with Qt Creator [clang-diagnostic-error]

I have a CMake project where i try to run clang-tidy checks and fixes during the build. Everything works with clang-tidy from llvm 12.0.1(also tried 11.0.0) installed with brew.

When i try to use the clang-tidy(11.0.0 and 12.0.0 from Qt Creator 5.0.0 beta) shipped with Qt Creator so the people using the project doesn't have to install it, i get the error:

licensing.h:3:10: error: 'string' file not found [clang-diagnostic-error]
#include <string>
         ^

the CMakeLists.txt part looks like this:

set(CMAKE_CXX_CLANG_TIDY
    ${CLANG_TIDY_BIN}
    --format-style=file
    --header-filter
    --config=
    --fix
    )

you not include the system lib file. you should inlcude the dir as follows: "-Iexternal/llvm_toolchain_llvm/include/c++/v1/", "-Iexternal/llvm_toolchain_llvm/include/x86_64-unknown-linux-gnu/c++/v1/"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM