Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

traits.hpp - type is not a member - compilation error

I am using VS2015 C++/CLI, CUDA 9.1, and OpenCV 3.4 on a Win10 machine.

I have successfully compiled OpenCV 3.4 and it appears to be working in a standalone, single threaded configuration, that does not rely on WinForms. Now, I am trying to compile a WinForms version of my code and am hitting a compilation error.

In particular, right away, I get an error saying:

MyForm.cpp
1>C:\Opencv34\opencv-3.4.0\modules\core\include\opencv2/core/traits.hpp(366): error C2039: 'type': is not a member of 'cv::DataType<std::T>'
1>          with
1>          [
1>              T=std::size_t
1>          ]
1>  C:\Opencv34\opencv-3.4.0\modules\core\include\opencv2/core/traits.hpp(366): note: see declaration of 'cv::DataType<std::T>'
1>          with
1>          [
1>              T=std::size_t
1>          ]
1>  C:\Opencv34\opencv-3.4.0\modules\core\include\opencv2/core/mat.inl.hpp(292): note: see reference to class template instantiation 'cv::traits::Type<std::_Tp>' being compiled
1>          with
1>          [
1>              _Tp=std::size_t
1>          ]
1>  c:\opencv\modules\flann\include\opencv2\flann\lsh_table.h(356): note: see reference to function template instantiation 'cv::debug_build_guard::_InputOutputArray::_InputOutputArray<std::size_t>(std::vector<std::size_t,std::allocator<std::_Ty>> &)' being compiled
1>          with
1>          [
1>              _Ty=std::size_t
1>          ]
1>C:\Opencv34\opencv-3.4.0\modules\core\include\opencv2/core/traits.hpp(366): error C2065: 'type': undeclared identifier
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

I saw this question: here That suggested that opencv_traits_enabled_deprecated might be undefined. However, when I look at CMakelists.txt it appears that as long as HAVE_CUDA was defined, it would have been defined and I have CUDA installed.

Not sure how to solve this or what the problem is. Any help appreciated.