Closed antonymott closed 11 years ago
Does it just give you a warning message that you can ignore?
I added the cv::core namespace recently because the function printShortCudaDeviceInfo() was moved from the cv::gpu module to the cv::core module in recent versions of OpenCV, so hard-coding it to cv::gpu::printShortCudaDeviceInfo() works in old versions and cv::core::printShortCudaDeviceInfo() works in new versions, but the current solution should work in both. Unless if you are getting an actual build error saying that it won't build due to the unused namespace?
If it really does cause build errors for some versions of OpenCV then we will just remove the printShortCudaDeviceInfo() call completely since it is just for handy debugging anyway.
The build error was fatal. In tracking it down, I looked in core.hpp for cv:: namespaces. I located namespaces cv, cv::ogl and cv::gpu, but I could not find cv::core. Can you let me know in which opencv2 file should be the namespace cv::core, as perhaps the problem is local and my builds of opencv2 are missing a cv::core namespace that it ought to have.
It's in the file GPUSURFFeatureMatcher.cpp like you said. The git changelist is https://github.com/MasteringOpenCV/code/commit/b5a65e281b5e6774c0e7ddd5de63ba394a0fb743. I don't understand why adding a cv::core namespace to your code should cause any build error, because cv::core is obviously the main "core" of OpenCV so it should be included in your project already. Unless if you have set a compiler flag where it treats warning messages are errors?
Oh, I meant where is cv::core declared in OpenCV2 (not where is it referenced in GPUSURFFeatureMatcher.cpp).
Wow you are right, there is no "cv::core" namespace! Someone tested this change of OpenCV v2.3 and said it worked for them, so maybe the "cv::core" namespace has been removed. Anyway, the printShortCudaDeviceInfo() call is not important to the book code, so I will comment it out, and anyone that wants to use it can uncomment it if they have OpenCV v2.4. Thanks for the feedback and Amazon review!
Severity: build fail Issue: Chapter 4, Exploring SfM, GPUSURFFeatureMatcher.cpp references non-existing namespace cv::core in tested opencv versions of /include/opencv2/core/core.hpp Tested OpenCV2.3.x or higher on Unix (Linux/Mac) Suggested bug-fix: comment-out or remove the line "using namespace cv::core" (near line 23) of GPUSURFFeatureMatcher.cpp Comment: builds and runs OK after suggested bug-fix. -Antony