English 中文(简体)
即使在CGO-CXXFLAGS(CXXFLAGS)下也找不到头盔。
原标题:Using Go on Windows 11 with gocv for OpenCV cannot find header opencv.hpp even with CGO_CXXFLAGS set

When running go run, not found. But when listing dir, the header is right there...

PS C:UsersphiliSourceCodegoopencv> set CGO_CPPFLAGS="-IC:/Users/phili/SourceCode/opencv/build/include"

PS C:UsersphiliSourceCodegoopencv> go run -tags customenv "C:Usersphiligopkgmodgocv.iox[email protected]cmdversionmain.go"

# gocv.io/x/gocv
In file included from aruco.cpp:1:0:
aruco.h:5:10: fatal error: opencv2/opencv.hpp: No such file or directory
 #include <opencv2/opencv.hpp>
          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.

/*        */

PS C:UsersphiliSourceCodegoopencv> dir C:UsersphiliSourceCodeopencvuildincludeopencv2opencv.hpp

    Directory: C:UsersphiliSourceCodeopencvuildincludeopencv2

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         9/27/2023   9:54 AM           3558 opencv.hpp

PS C:UsersphiliSourceCodegoopencv>

我还尝试在MSYS2中安装,并出现不同的错误:

phili@PhilBook3 UCRT64 ~/gocv
$ go run "C:msys64ucrt64libgopkgmodgocv.iox[email protected]cmdversionmain.go"

# gocv.io/x/gocv
C:Usersphiligopkgmodgocv.iox[email protected]calib3d_string.go:3:9: undefined: CalibFlag
C:Usersphiligopkgmodgocv.iox[email protected]calib3d_string.go:29:9: undefined: CalibCBFlag
...
C:Usersphiligopkgmodgocv.iox[email protected]core_string.go:159:9: too many errors

我只想把它放在尽可能好的窗口上。

如果任何人有任何想法,那将是伟大的!

问题回答

same error:

"C:Program FilesGoingo.exe" run D:Golangopencv	est.go
gocv.io/x/gocv
In file included from aruco.cpp:1:
aruco.h:5:10: fatal error: opencv2/opencv.hpp: No such file or directory
5 | #include <opencv2/opencv.hpp>
|          ^~~~~~~~~~~~~~~~~~~~
compilation terminated.

解决办法:

copy your opencv/build/install/inlude/opencv2  directory to gopkgmodgocv.iox[email protected]  directory then error disappear




相关问题
Python/OpenCV: Converting images taken from capture

I m trying to convert images taken from a capture (webcam) and do some processing on them with OpenCV, but I m having a difficult time.. When trying to convert the image to grayscale, the program ...

How to smooth a histogram?

I want to smooth a histogram. Therefore I tried to smooth the internal matrix of cvHistogram. typedef struct CvHistogram { int type; CvArr* bins; float thresh[CV_MAX_DIM][2]; /* ...

Testing complex datatypes?

What s are some ways of testing complex data types such as video, images, music, etc. I m using TDD and wonder are there alternatives to "gold file" testing for rendering algorithms. I understand that ...

Displaying OpenCV iplimage data structures with wxPython

Here is my current code (language is Python): newFrameImage = cv.QueryFrame(webcam) newFrameImageFile = cv.SaveImage("temp.jpg",newFrameImage) wxImage = wx.Image("temp.jpg", wx.BITMAP_TYPE_ANY)....

What is the memory structure of OpenCV s cvMat?

Imagine I have the following: CvMat* mat = cvCreateMat(3,3,CV_16SC3) This is a 3x3 matrix of integers of channel 3. Now if you look at OpenCV documentation you will find the following as the ...

Face detection and comparison

I m running a small research on face detection and comparison for my article. Currently, I m using rapid face detection based on haar like features based on OpenCV cascade (I ll implement learning ...

热门标签