以下代码编译无误,但在我尝试执行时,出现了“动态链接库libopencv_core2413.dll中找不到过程入口_ZSt24__throw_out_of_range_fmtPKcz”的错误提示。原始信息为葡萄牙语。
我已经尝试了其他版本的OpenCV,包括最新版本和2.4.7等。每次我都只是构建它,然后在尝试执行编译好的程序后得到相同的错误。我已经尝试指定编译器(我安装了其他版本的mingw),对于gcc使用C:\ mingw \ bin \ gcc.exe,对于g ++使用C:\ mingw \ bin \ g ++.exe。没有成功,还是出现了同样的错误。我尝试安装一个新版本的mingw,并将其放在C:\ mingwnew中,并指定编译器。对于gcc使用C:\ mingwnew \ bin \ gcc.exe,对于g ++使用C:\ mingwnew \ bin \ g ++.exe。但还是没有成功。
生成后,我只需进入c:\ opencv \ build文件夹并键入C:\ mingw \ bin \ mingw32-make.exe(或另一种尝试中的C:\ mingwnew \ bin \ mingw32-make.exe)。有关opencv代码本身的警告(我尝试了一些不同的版本)会出现几个警告。之后,它以没有任何错误的方式结束。我键入C:\ mingw \ bin \ mingw32-make.exe install。之后,我在C:\ opencv \ build \ install \ x86 \ mingw中有一个新文件夹。在C:\ opencv \ build \ install \ x86 \ mingw \ bin中有一些示例,我尝试执行它们。但还是出现了同样的错误。
之后我尝试了以下几件事情:
- 将C:\ opencv \ build \ install \ x86 \ mingw文件夹复制到我的mingw中。将libs和dlls复制到我的项目文件夹目录中(该路径中没有空格),将dlls复制到system32文件夹中。并尝试使用-Wall编译,没有错误,但尝试执行时仍然出现相同的错误。 - 使用以下命令静态编译: c:/ mingw / bin / g ++.exe -Wall -I“C:/ opencv / build / install / include”loadimg.cpp libopencv_core2413.dll.a libopencv_highgui2413.dll.a -o loadimg。 - 使用以下命令编译: c:/ mingw / bin / g ++.exe -Wall -I“C:/ opencv / build / install / include”-L“C:/ opencv / build / install / x86 / mingw / lib”loadimg.cpp -lopencv_core2413 -lopencv_highgui2413 -o loadimg。 - 尝试使用Dependency Walker,但只得到在新操作系统(Windows 10)中使用它时预期的一些错误。我在另一个线程中找到了它,但它没有给我任何线索。 - 尝试使用旧版本OpenCV的预编译二进制文件。但还是出现了同样的错误。 - 尝试使用mingw64,甚至无法编译hello world。似乎它仍然存在许多错误。但我认为mingw32不是问题,因为我以同样的方式使用mingw32编译了其他库(allegro5),并且它可以工作。
#include "opencv2/highgui.hpp"
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/opencv.hpp"
#include "opencv2/opencv_modules.hpp"
int main()
{
cv::Mat a;
return 0;
}
首先,我从sourceforge链接下载了源代码,然后构建它。Cmake版本为3.5.0-rc2,mingw版本为4.9.3,opencv版本为2.4.13。我在mingw上安装了haskell和allegro5库。
下载完成后,我将其解压到了C:/opencv目录下。使用cmake-gui,我将源文件夹设置为C:/opencv/sources,构建文件夹设置为C:/opencv/build。关于配置标志,我只取消了BUILD_opencv_pyhon的标记,因为我没有安装python。这是配置和生成步骤的日志:
Detected version of GNU GCC: 49 (409)
CUDA compilation is disabled (due to only Visual Studio compiler supported on your platform).
General configuration for OpenCV 2.4.13 =====================================
Version control: unknown
Platform:
Host: Windows 10.0.10586 AMD64
CMake: 3.5.0-rc2
CMake generator: MinGW Makefiles
CMake build tool: C:/MinGW/bin/mingw32-make.exe
Configuration: Release
C/C++:
Built as dynamic libs?: YES
C++ Compiler: C:/MinGW/bin/g++.exe (ver 4.9.3)
C++ flags (Release): -fsigned-char -mstackrealign -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-array-bounds -Wno-aggressive-loop-optimizations -fdiagnostics-show-option -march=i686 -fomit-frame-pointer -msse -msse2 -mfpmath=sse -ffunction-sections -O2 -DNDEBUG -DNDEBUG
C++ flags (Debug): -fsigned-char -mstackrealign -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-array-bounds -Wno-aggressive-loop-optimizations -fdiagnostics-show-option -march=i686 -fomit-frame-pointer -msse -msse2 -mfpmath=sse -ffunction-sections -g -O0 -DDEBUG -D_DEBUG
C Compiler: C:/MinGW/bin/gcc.exe
C flags (Release): -fsigned-char -mstackrealign -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -Wno-array-bounds -Wno-aggressive-loop-optimizations -fdiagnostics-show-option -march=i686 -fomit-frame-pointer -msse -msse2 -mfpmath=sse -ffunction-sections -O2 -DNDEBUG -DNDEBUG
C flags (Debug): -fsigned-char -mstackrealign -W -Wall -Werror=return-type -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wno-narrowing -Wno-array-bounds -Wno-aggressive-loop-optimizations -fdiagnostics-show-option -march=i686 -fomit-frame-pointer -msse -msse2 -mfpmath=sse -ffunction-sections -g -O0 -DDEBUG -D_DEBUG
Linker flags (Release):
Linker flags (Debug):
Precompiled headers: YES
OpenCV modules:
To be built: core flann imgproc highgui features2d calib3d ml video legacy objdetect photo gpu ocl nonfree contrib stitching superres ts videostab
Disabled: python world
Disabled by dependency: -
Unavailable: androidcamera dynamicuda java viz
Windows RT support: NO
GUI:
QT: NO
Win32 UI: YES
OpenGL support: NO
VTK support: NO
Media I/O:
ZLib: build (ver 1.2.7)
JPEG: build (ver 62)
PNG: build (ver 1.5.12)
TIFF: build (ver 42 - 4.0.2)
JPEG 2000: build (ver 1.900.1)
OpenEXR: build (ver 1.7.1)
Video I/O:
Video for Windows: YES
DC1394 1.x: NO
DC1394 2.x: NO
FFMPEG: YES (prebuilt binaries)
codec: YES (ver 55.18.102)
format: YES (ver 55.12.100)
util: YES (ver 52.38.100)
swscale: YES (ver 2.3.100)
resample: NO
gentoo-style: YES
OpenNI: NO
OpenNI PrimeSensor Modules: NO
PvAPI: NO
GigEVisionSDK: NO
DirectShow: YES
Media Foundation: NO
XIMEA: NO
Intel PerC: NO
Other third-party libraries:
Use IPP: NO
Use Eigen: NO
Use TBB: NO
Use OpenMP: NO
Use GCD NO
Use Concurrency NO
Use C=: NO
Use Cuda: NO
Use OpenCL: YES
OpenCL:
Version: dynamic
Include path: C:/opencv/sources/3rdparty/include/opencl/1.2
Use AMD FFT: NO
Use AMD BLAS: NO
Python:
Interpreter: D:/Ferramentas/[Ferramenta]_Phyton/python.exe (ver 2.7.10)
Java:
ant: NO
JNI: C:/Program Files/Java/jdk1.8.0_91/include C:/Program Files/Java/jdk1.8.0_91/include/win32 C:/Program Files/Java/jdk1.8.0_91/include
Java tests: NO
Tests and samples:
Tests: YES
Performance tests: YES
C/C++ Examples: NO
Install path: C:/opencv/build/install
cvconfig.h is in: C:/opencv/build
-----------------------------------------------------------------
CMake Warning at cmake/OpenCVPackaging.cmake:23 (message):
CPACK_PACKAGE_VERSION does not match version provided by version.hpp
header!
Call Stack (most recent call first):
CMakeLists.txt:1105 (include)
Configuring done
Generating done
我已经尝试了其他版本的OpenCV,包括最新版本和2.4.7等。每次我都只是构建它,然后在尝试执行编译好的程序后得到相同的错误。我已经尝试指定编译器(我安装了其他版本的mingw),对于gcc使用C:\ mingw \ bin \ gcc.exe,对于g ++使用C:\ mingw \ bin \ g ++.exe。没有成功,还是出现了同样的错误。我尝试安装一个新版本的mingw,并将其放在C:\ mingwnew中,并指定编译器。对于gcc使用C:\ mingwnew \ bin \ gcc.exe,对于g ++使用C:\ mingwnew \ bin \ g ++.exe。但还是没有成功。
生成后,我只需进入c:\ opencv \ build文件夹并键入C:\ mingw \ bin \ mingw32-make.exe(或另一种尝试中的C:\ mingwnew \ bin \ mingw32-make.exe)。有关opencv代码本身的警告(我尝试了一些不同的版本)会出现几个警告。之后,它以没有任何错误的方式结束。我键入C:\ mingw \ bin \ mingw32-make.exe install。之后,我在C:\ opencv \ build \ install \ x86 \ mingw中有一个新文件夹。在C:\ opencv \ build \ install \ x86 \ mingw \ bin中有一些示例,我尝试执行它们。但还是出现了同样的错误。
之后我尝试了以下几件事情:
- 将C:\ opencv \ build \ install \ x86 \ mingw文件夹复制到我的mingw中。将libs和dlls复制到我的项目文件夹目录中(该路径中没有空格),将dlls复制到system32文件夹中。并尝试使用-Wall编译,没有错误,但尝试执行时仍然出现相同的错误。 - 使用以下命令静态编译: c:/ mingw / bin / g ++.exe -Wall -I“C:/ opencv / build / install / include”loadimg.cpp libopencv_core2413.dll.a libopencv_highgui2413.dll.a -o loadimg。 - 使用以下命令编译: c:/ mingw / bin / g ++.exe -Wall -I“C:/ opencv / build / install / include”-L“C:/ opencv / build / install / x86 / mingw / lib”loadimg.cpp -lopencv_core2413 -lopencv_highgui2413 -o loadimg。 - 尝试使用Dependency Walker,但只得到在新操作系统(Windows 10)中使用它时预期的一些错误。我在另一个线程中找到了它,但它没有给我任何线索。 - 尝试使用旧版本OpenCV的预编译二进制文件。但还是出现了同样的错误。 - 尝试使用mingw64,甚至无法编译hello world。似乎它仍然存在许多错误。但我认为mingw32不是问题,因为我以同样的方式使用mingw32编译了其他库(allegro5),并且它可以工作。
我搜索了很多资料,尝试了很多方法,包括使用opencv文档提供的其他示例代码。但是由于我不能安装linux,也无法使用其他电脑,因此这是我唯一的选择。经过数十次构建opencv和两周的时间,我依然无法自己解决错误。
有任何线索或需要更多信息吗?谢谢。