I'm currently using Conan on a C++ project using sqlite_orm
as a dependency.
When using my personal include (like myClass.hpp
for example) Visual Studio Code is able to provide auto-completion but with Conan's include, no auto-completion is possible.
I'm looking for a way to link the include path of Conan to my VSCode, any idea?
Use Conan Extension for Visual Studio To use this extension you will need a conanfile. txt or conanfile.py in your Visual Studio project declaring the requirements of your project. Conan will download them from the configured remotes (or build them if binaries are not available), the extension will generate the .
Go to settings (ctrl+,) -> Search settings -> : Code-runner : Run in terminal - Check this and you will be able to run the code directly in the terminal which takes input. :) Show activity on this post. Make sure you have code runner installed on your VS code. By default it remains unchecked.
Add the following line in your project's .vscode/c_cpp_properties.json
file
"includePath": ["${workspaceFolder}/**", "~/.conan/data/**"]
Add set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
to your CMakeLists.txt (or add to cmake: cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
) so a build/compile_commands.json
will be generated.
VS Code (clion, etc) can utilize this file to support auto complete:
$ cat .vscode/c_cpp_properties.json
{
"configurations": [
{
"name": "Linux",
"defines": [],
"compilerPath": "/usr/bin/g++",
"cStandard": "c11",
"cppStandard": "c++14",
"intelliSenseMode": "clang-x64",
"compileCommands": "${workspaceFolder}/build/compile_commands.json"
}
],
"version": 4
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With