Qt 中 OpenCV "Can't load OpenGL extension [glBindBuffer] in function IntGetProcAddress"例外

"Can't load OpenGL extension [glBindBuffer] in function IntGetProcAddress" exception of OpenCV in Qt

本文关键字:glBindBuffer extension function 例外 IntGetProcAddress OpenGL in load Can OpenCV Qt      更新时间:2023-10-16

我从opencv网站下载了OpenCV 2.4.6。为了避免我之前提到的问题,我决定编译OpenCV库。在CMake和Mingw32-make之后,编译成功。但是,一个简单的测试程序在显示 jpeg 图像时崩溃。这是我的 .pro 和主.cpp文件:

.pro:

TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp
#INCLUDEPATH += D:/opencv2.4.6/build/include
INCLUDEPATH += D:/opencv2.4.6/release/install/include
LIBS += -LD:/opencv2.4.6/release/install/bin 
    -lopencv_core246 
    -lopencv_highgui246 
    -lopencv_imgproc246 
    -lopencv_features2d246 
    -lopencv_calib3d246

主.cpp:

int main() {
    Mat input = imread("Z:/1.jpg");
    cv::imshow("1.jpg",input);
}

问题是这样的:

OpenCV Error: OpenGL API call (Can't load OpenGL extension [glBindBuffer]) in In
tGetProcAddress, file ......modulescoresrcgl_core_3_1.cpp, line 141
terminate called after throwing an instance of 'cv::Exception'
  what():  ......modulescoresrcgl_core_3_1.cpp:141: error: (-219) Can't lo
ad OpenGL extension [glBindBuffer] in function IntGetProcAddress

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.

我以前从未遇到过这样的问题。这有点奇怪。我应该怎么做才能摆脱这个问题?

在尝试编译OpenCV后,似乎应该取消选中WITH_OPENGL。现在程序正常运行。