'VSCode cannot find package but CLion can (CMake)
I was wondering what the difference is between using cmake and (compile_commands and compile_flags) in VSCode? I'm running into an issue where even though I've got my CMake set up correctly (builds just fine on Clion), I run into issues when trying to use the exact same code in VSCode.
I've got the offending line below
#include "palisade.h"
where palisade is installed in "/usr/local/include/palisade" and my CMake explicitly looks for it and finds it
find_package(Palisade)
I've also generated the file compile_commands.json
via cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=1
but I'm still running into issues of the library not being found
Solution 1:[1]
Probably it will helps.
In main CMakeLists.txt add line
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
and in c_cpp_properties.json
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
This will allow InteliSence to use the dependencies created by cmake.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | RTS007 |
