Issue
I have a c++ project that uses dependencies I installed via conda (geant4 and root). I'm using CMake to manage the project and VSCode as the editor.
Right now VSCode has no idea what is going on, highlighting all the dependencies as "file cannot be found" and the CMake extension can't find the CMake executable. Both is very understanable since they live in the conda env.
When googling for a way to deal with this I found nothing that was helpful, pretty much only Python stuff and some forum post saying that on linux you supposedly can just start VSCode via the command line inside the conda env and it should be fine.
How can I do this on Mac OS and with C++? I'd love to get proper hints for the libraries and for the CMake extension to work.
Solution
For Intellisense: add /path/to/conda/env/include to Extensions/C++/IntelliSense/Include Path in the vscode settings
For CMake:
- add
list(APPEND CMAKE_PREFIX_PATH "/path/to/conda/env")
to the CMakeLists.txt - set Extensions/CMake Tools/Cmake Path to /path/to/conda/env/bin/cmake in the vscode setting
Do a clean build
Answered By - Chalky Answer Checked By - Marilyn (WPSolving Volunteer)