0

Since I don't have much experience, installing new C/C++ packages, this might be an obvious mistake. However, I found no solution for it yet.

The official tutorial for installing opencv is a bit unclear: https://docs.opencv.org/4.x/d7/d9f/tutorial_linux_install.html

I followed the steps as described under Build with opencv_contrib. But I didn't follow the install steps since they sounded optional (h2). However, when I try to include opencv after building, opencv fails. How can I let VS Code know where to find my opencv build?

I am using the C/C++, C/C++ Runner extensions if that helps answering my question.

Natan
  • 728
  • 1
  • 7
  • 23
  • 1
    My advice is not to use the code runner extension for this. You probably want to use the CMakeTools extension instead and write a `CMakeLists.txt` for your project. – drescherjm Nov 06 '22 at 21:58
  • This extension is called `CMake Tools`. Would you mind giving a more detailed explanation on how to write a `CMakeLists.txt` or point me towards the right direction? – Natan Nov 08 '22 at 10:20
  • 1
    There is an example in the documentation; [https://docs.opencv.org/4.x/db/df5/tutorial_linux_gcc_cmake.html](https://docs.opencv.org/4.x/db/df5/tutorial_linux_gcc_cmake.html) although its a bit old and uses older CMake techniques. It still should work however. I will look for a better example. – drescherjm Nov 08 '22 at 13:30
  • 1
    Here is another old example: [https://stackoverflow.com/questions/13970377/configuring-an-c-opencv-project-with-cmake](https://stackoverflow.com/questions/13970377/configuring-an-c-opencv-project-with-cmake) – drescherjm Nov 08 '22 at 13:32
  • 1
    After more research the current opencv does not use the namespace alias feature of CMake so the above links are good. This will be used in opencv5: [https://github.com/opencv/opencv/issues/13117](https://github.com/opencv/opencv/issues/13117) – drescherjm Nov 08 '22 at 13:40

0 Answers0