6

I want to create a matrice in opencv for my project of raytracing. This is the code I have come up:

#include "Windows.h" #include "core/mat.hpp" #include "core/core.hpp" #include "core/types_c.h" using namespace cv; Mat createImage() { Mat b(480, 640, CV_8UC3); return b; } 

And I have problem with the two Mat. It says variable has incomplete type "cv::Mat". I can't understand what it means. I always wrote only Mat nothing else.

Can someone help me please?

7
  • You should only include core.hpp, but is sounds like a linker error Commented Jan 9, 2014 at 21:39
  • I found a response on stackoverflow on how to link opencv with xcode, so I followed all the step. So does this linker error is something about xcode itself? Commented Jan 9, 2014 at 22:22
  • This looks more like a compiler error to me, not a linker output. Commented Jan 9, 2014 at 22:31
  • how do xcode and window.h go together ? sounds you made some general mess of it .. Commented Jan 9, 2014 at 22:57
  • 1
    start with readjusting your include path, so it points to opencv/build/include. try with only: #include "opencv2/core/core.hpp" , skip all other headers (especially the windows.h one). Commented Jan 9, 2014 at 23:00

2 Answers 2

5

Just include "opencv2/core/core.hpp".
You can use below example code.

#include "opencv2/core/core.hpp" using namespace cv; Mat createImage() { Mat b(480, 640, CV_8UC3); return b; } int main() { createImage(); } 
Sign up to request clarification or add additional context in comments.

Comments

0

You only need to '#include "core/core.hpp"`

The compiler needs to be able to find the include files, do you have Opencv/Include in the compiler's include directory list? Did it give any error about finding core.hpp?

1 Comment

I just included core/core.hpp and I had also to include type.hpp because CV_8UC3 is not in core.hpp and I still have this problem. :(

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.