I need your help !
I have this C++ code in this link
[link] https://github.com/royshil/FoodcamClassifier
and I've been trying since two days to compaile it , and I've failed
they say that I have to use cmake , I've tried the "GUI version and it gave me errors realted to the cmake itself .
so I took the cpp and header files and made a new project but I have now 100 errors related to the opencv library and I swear to god I'm sure of the include folders and the libs of it in my project ! don't know what's the matter with it !
any idea ?
Here's the errors :
'CMake Error: Unable to open cache file for save. C:/Program Files/CMake 2.8/bin/CMakeCache.txt CMake Error at CMakeLists.txt:4 (FIND_PACKAGE): Could not find module FindOpenCV.cmake or a configuration file for package OpenCV. Adjust CMAKE_MODULE_PATH to find FindOpenCV.cmake or set OpenCV_DIR to the directory containing a CMake configuration file for OpenCV. The file will have one of the following names: OpenCVConfig.cmake opencv-config.cmake OpenCV_DIR-NOTFOUND Configuring incomplete, errors occurred! CMake Error: Unable to open cache file for save. C:/Program Files/CMake 2.8/bin/CMakeCache.txt CMake Error: : System Error: Permission denied CMake Error: : System Error: Permission denied '
Best Answer
So, this is what fixed this for me.
Firstly, if in doubt - always remember to clear out your CMake "cache" before trying adding some-other path/value/mod. Seems a bit weird I know, but the legacy of previous attempts to fix things may be obsuring the true problem. Simplest way to do this is to nuke your out-of-source "build" directory from orbit (only way to be sure) and try again...
Secondly, and more fundamentally, what is your target compiler & architecture here and what is provided by the version of OpenCV you've downloaded? For example, as of the time of writing the OpenCV 3.1 pre-built installer I downloaded provides
~\build\x64\vc12 & vc14
- which were of course for building against VisualStudio 2012 & 2014.I was using Mingw and targeting x86 - so I downloaded the source (via github release as a
*.zip
file) and did these steps from within the\opencv
folder:You can of course control the build by various switches and also dictate where an install should go.
Doing the "install" step - by which by default is to copy the final libraries etc. into a folder called "install" - is key as it correctly puts all the resulting libs and files in the right place and includes the magical
OpenCVConfig.cmake
file at the top.Thus, I could finally point my project CMakeLists.txt file to resolve OpenCV with:
And, making sure the resulting executable was aware of the *.dll's with: