Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[opencv] 'Cannot open source file "opencv/opencv.hpp"' and opencv include folder does not exist after installation #43110

Open
m-riley04 opened this issue Jan 5, 2025 · 1 comment
Assignees
Labels
category:question This issue is a question

Comments

@m-riley04
Copy link

m-riley04 commented Jan 5, 2025

Describe the bug
When attempting to install "opencv", it only installs "opencv4" with no error messages. This leads to issues when attempting to include the library in my Visual Studio projects, with the error cannot open source file "opencv/opencv.hpp".

Environment

  • OS: Windows 11 (Desktop)
  • Compiler: MSVC

To Reproduce
Steps to reproduce the behavior:

  1. Run ./vcpkg install opencv in the vcpkg root folder (or just vcpkg install with "opencv" in the vcpkg.json file if you are in manifest mode)
  2. After it says it successfully installed, navigate to the "include" folder within the installation folder (usually "installed/x64-windows/include")
  3. If using a manifest file, put #include <opencv/opencv.hpp> at the top of any source file and attempt to build

Minimum Repoductable Code

  1. Install vcpkg, including running vcpkg integrate install
  2. Follow the Visual Studio vcpkg MSVC steps to create a new VS vcpkg manifest project
  3. Make sure to add the opencv dependency to the manifest file and to add #include <opencv/opencv.hpp> to the top of the initial file (as per the instructions)
  4. Attempt to build

Expected behavior
I expect to be able to include opencv in my project, and there to be an "opencv" include folder as there always has been.

Errors
When attempting to build my Visual Studio C++ project with opencv included, it gives the error cannot open source file "opencv/opencv.hpp".
There is only a "opencv4" include folder, which leads to VS not being able to find the correct include path for "opencv/opencv.hpp". I've noticed sometimes it is even "opencv2".
There appears to be no build errors for specifically vcpkg or for building opencv; it just seems like they are not linking correctly and/or the include folders do not exist.

Additional context
I have been working on the same project with the same manifest file for the past 2-3 months and had no issues. This just started happening in the past few days.
I tried running git pull on the vcpkg root folder, and I tried updating the baseline for my project manifest. I have fully reinstalled vcpkg multiple times and have followed the official MSVC manifest instructions. I have cleared all of the cache from my "AppData/Local/vcpkg" folder and "AppData/Local/Temp" folder as well. Nothing has worked.
Interestingly, it appears that the project on my laptop is still building/working.

@JonLiu1993 JonLiu1993 added the category:question This issue is a question label Jan 6, 2025
@JonLiu1993
Copy link
Member

Thanks for submitting this issue. This issue has been discussed in the previous issue. Please refer to this comment for details: #42004 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:question This issue is a question
Projects
None yet
Development

No branches or pull requests

2 participants