[英]dlib on Qt Windows. The program has unexpectedly finished
I try to use dlib in Qt project on Windows. 我尝试在Windows的Qt项目中使用dlib。 After downloading I did this in the dlib root:
下载后,我在dlib根目录中执行了此操作:
cd examples
mkdir build
cd build
cmake .. -G"Visual Studio 14 2015 Win64"
cmake --build . --config Release
And this(again in dlib root): 这(再次在dlib根目录中):
mkdir build
cd build
cmake .. -G"Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=D:\dlib_build
cmake --build . --config Release --target install
My .pro file: 我的简历:
QT += core
QT -= gui
CONFIG += c++11
TARGET = dlibWin2
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += "D:\dlib_build\include"
LIBS += -L"D:\dlib_build\lib" -ldlib
QMAKE_CXXFLAGS_RELEASE += /arch:AVX
QMAKE_CXXFLAGS += -DDLIB_JPEG_SUPPORT
main.cpp: main.cpp中:
#include <QCoreApplication>
#include <dlib/image_processing/frontal_face_detector.h>
#include <dlib/image_processing/render_face_detections.h>
#include <dlib/image_processing.h>
#include <dlib/gui_widgets.h>
#include <dlib/image_io.h>
#include <iostream>
using namespace dlib;
using namespace std;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
try
{
frontal_face_detector detector = get_frontal_face_detector();
}
catch (exception& e)
{
cout << "\nexception thrown!" << endl;
cout << e.what() << endl;
}
return a.exec();
}
Compilation output for MSVC2015 64bit Release: MSVC2015 64位版本的编译输出:
D:\dlib_build\include\dlib\config.h:19: Warning: C4005: DLIB_JPEG_SUPPORT
Runtime output for MSVC2015 64bit Release: MSVC2015 64位版本的运行时输出:
The program has unexpectedly finished... Exited with code -1073741795
程序意外完成...退出,代码为-1073741795
Please note that I did this after Windows reinstalling, and before this I got absolutely the same issue. 请注意,我是在Windows重新安装后执行此操作的,在此之前我遇到了绝对相同的问题。
How can I solve this or how can I use dlib in Qt on Windows? 如何解决此问题,或者如何在Windows的Qt中使用dlib?
As you dont see an exception output - the problem should be in /arch:AVX part. 如您未看到异常输出-问题应该在/ arch:AVX部分中。 May be your processor does not support AVX instructions.
可能是您的处理器不支持AVX指令。 In x64 mode SSE2 will be enabled automatically
在x64模式下,SSE2将自动启用
Try this .pro file: 试试这个.pro文件:
QT += core
QT -= gui
CONFIG += c++11
TARGET = dlibWin2
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp
INCLUDEPATH += "D:\dlib_build\include"
LIBS += -L"D:\dlib_build\lib" -ldlib
No need to rebuild examples and dlib. 无需重建示例和dlib。 -DDLIB_JPEG_SUPPORT removed because you have C4005 warning.
-DDLIB_JPEG_SUPPORT已删除,因为您收到C4005警告。
You are one one step from success! 您是成功的第一步!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.