I have a C++ OpenCV project that uses Visual Studio Code with a CMake file.
It runs on a Ubuntu OS.
Now I switched from cmake file to configuration using json files.
In the cmake file I did not have to add the include path for OpenCV. But now it can not find the opencv hpp files so I have to include the include path in .vscode/c_cpp_properties.json
But when including
/usr/local/include/opencv4
or
/usr/local/include/opencv4/
or
/usr/local/include/opencv4/**
it still can not find it.
While I checked and the include files are present there.
But the CMake file is not the problem. I had a project running using CMake.
But I had to switch to the json file way of configuration (Visual Studio Code).
Now I need the include path for OpenCV. And I can not find out what this path should be.
I’m confused.
I use Visual Studio Code (VSCode) on Ubuntu for my C++ OpenCV project.
I use the .json files for cofiguration (tasks.json, launch.json and c_cpp_properties.json).
How do I now tell the compiler which (OpenCV) include files to use? And which libraries to use for linking?
I would like to do that without using CMake files. Is that possible? If so, how?
I would like to only use the json files. No make files. This because it is easier for me to understand. But also because when I added a CMake file the launch.json didn’t function correct anymore. I need to run the debugger in sudo mode and that can be done with the correct lines in the launch.json file. But with the CMake file added, it did not work anymore.
I assumed the include files should be listed in the c_cpp_properties.json file. But I found out that this is only for the Intelisense functionality.
The include paths and library paths need to be added to the arguments for the compiler in the tasks.json file.
Yes, I had CMake working too in combination with VSCode. But in combination with a launch.json file it did not work for me. I need the launch.json to make the debugger run in sudo mode.
Therefore I want to use the tasks.json to make the project.
Anyway, my question was how to define the include directory paths and library paths in the json files.