Unable to build CVZ as 'opencv2/opencv.hpp' cannot be found
Closed this issue · 22 comments
I have installed opencv3.0.0 as instructed in the WYSIWYD readme. The opencv installation goes fine, but when I try to build WYSIWYD there will be the following error:
error C1083: Cannot open include file: 'opencv/opencv.hpp': No such file or directory
This is found in the projects cvxFiber
, cvzCore
, cvzHierarchyXmlBuilder
and cvzStackExample
. However in cvzVisualHierarchy
, there were several other errors, mostly syntax, which is also strange.
I have already checked that the opencv_dir points to the newly built opencv3. Also, I have tried to shift the file opencv.hpp file manually into the opencv lib folder but that did not work either.
Has anyone any idea how this can be resolved?
- Try removing your
build
folder, and try again from scratch. - Please post the output of
cat CMakeCache.txt | grep OpenCV
I have removed the build
folder and rebuilt it...several times. To the same result. And I'm using windows, so I'm not sure which file cat CMakeCache.txt | grep OpenCV
should yield, but I have attached the CMakeCache.txt
in opencv/build.
CMakeCache.txt
I meant the CMakeCache.txt
in wysiwyd/main/build
.. (and removing the wysiwyd/main/build
folder, not the opencv/build
folder).
As it's Windows, I won't be able to help. Maybe @pattacini or @maxime-petit can have a look.
This is the CMakeCache.txt in wysiwyd/main/build
.
I assume that this is due to not having OpenCV
in the include_directories
and target_link_libraries
in the modules you mentioned, although they indirectly include opencv/opencv.hpp
(they include cvz/gui/all.h
which includes GuiNN.h
which includes cvz/core/CvzNN.h
which includes opencv2/opencv.hpp
.
- Can you remove
#include <opencv2/opencv.hpp>
fromcvz/core/CvzNN.h
and see whether it compiles? - Can you try adding
${OpenCV_INCLUDE_DIRS}
and${OpenCV_LIBRARIES}
respectively in theCMakeLists.txt
files of the modules you refer to, and see whether this solves the issue?
It still doesn't work; I have attached one of the CMakeLists.txt
(from cvzHierarchyXmlBuilder
) for reference as to how I added the ${OpenCV_INCLUDE_DIRS}
and ${OpenCV_LIBRARIES}
.
There is no reference to OpenCV
in your CMakeLists.txt
at all ..
Did you try solution 1)?
If this doesn't help, I'm afraid @pattacini or @maxime-petit have to kick in, as I have no clue about compiling on Windows.
I added it into the include_directories
of the CMakeLists.txt
. Solution 1) did not help either :/ it's all very strange because I did manage to build it before. I thought it would be something that I changed, so I pulled the entire wysiwyd
folder from github and tried to recompile from there but it still didn't work.
Do you have the opencv.hpp
file in C:/Users/sock/robotology/opencv/build/opencv2
?
No, it is in C:/Users/sock/robotology/opencv/include/opencv2
. I did manually put it in build/opencv2
but that did not help either.
Can you upload the (modified) CMakeLists.txt
you are using? The uploaded version above is just the standard version without any modifications.
Oups yes sorry :D C:/Users/sock/robotology/opencv/include/opencv2
is fine
Can you check also if you have another opencv directory installed? And check your variable environment (OpenCV_DIR and PATH).
I don't have opencv3 installed on my windows machines but I will take a look
In my PATH
I have included the directory C:\Users\sock\robotology\opencv\build\bin\Release
, the OpenCV_DIR
is C:\Users\sock\robotology\opencv\build
. The uploaded CMakeLists.txt
differs from the standard version in the include_directories
portion where I had added the ${OpenCV_INCLUDE_DIRS}
and ${OpenCV_LIBRARIES}
.
Hi guys,
Same as @Tobias-Fischer , I am not very skilled in Windows compilation :/
As a light contribution however:
@max says that "C:/Users/sock/robotology/opencv/include/opencv2
is fine" for cmake
to find opencv.hpp
. But from what I know the only path we provide to cmake
is the build
directory, so how could it find include/opencv2
?
Hmmm, sorry, I can't help in this case .. Out of ideas for remote Windows debugging ..
There shouldn't be any difference in this case between Windows and Linux, as we're using cmake just for that purpose 😉 It must be a problem due to how opencv has been installed and/or how cvz
might be in sync with latest opencv releases.
I cannot go through the compilation of cvz
given that I don't have GTK2
, which is a required dependency. I've got also a concern about cvz
: it's a project per se which we don't use as far as I know and therefore I'd really suggest to hive it off from wysiwyd and provide it from a dedicated repository. Is there any plan to use it within wysiwyd?
I'm leaving to Leipzig and cannot help until next Tuesday.
However, I'm pretty confident you'll have sorted it out by then: it's just a matter of compiling code 😄
Getting shot of GTK2
might also help...
@sockchinglow By the way, what's the output of git log -1
? As a quick fix, you can set WYSIWYD_USE_GTK2
to OFF
, it's only used by the cvz
stuff.
@pattacini Happy to remove cvz
as long as the guys at UPF are happy as well @jypuigbo @clement-moulin-frier - I agree it's a waste of time trying to get a module compiled we don't use.
@Tobias-Fischer I think WYSIWYD_USE_GTK2
is an output variable, thus not used as input and therefore toggling it to OFF
won't have any effect: it'll be overwritten with ON
when checking for the availability of GTK2
.
To disable cvz
compilation @sockchinglow should comment out these lines:
@sockchinglow can you compile just iol2opc
to verify that the remaining modules are ok with your installation of opencv-3.0.0
?
- It that's the case, then it's very likely that
cvz
must be upgraded. - If
iol2opc
fails to compile, then your installation ofopencv-3.0.0
could be wrong somehow.
@pattacini
WYSIWYD_HAS_GTK2
is the output variable, as far as I know WYSIWYD_USE_GTK2
has the desired effect of being able to switch compilation off although the library is present.
@Tobias-Fischer you're right, although I've bad memories of playing with those cmake vars.
I managed to build the wysiwyd
project after removing the cvz
module! In addition to commenting the lines that @pattacini mentioned, I also "turned off" the variables WYSIWYD_USE_GTK2
and, just in case, ICUB_USE_GTK2
.
Thanks for your help @Tobias-Fischer @pattacini @maxime-petit @clement-moulin-frier! Since we don't use the cvz
module, I guess even though we still don't know what the issue is we can consider this issue resolved.