【发布时间】:2016-11-08 01:30:09
【问题描述】:
我尝试在 Windows 上的 Qt 项目中使用 dlib。下载后,我在 dlib 根目录中执行此操作:
cd examples
mkdir build
cd build
cmake .. -G"Visual Studio 14 2015 Win64"
cmake --build . --config Release
还有这个(再次在 dlib 根目录中):
mkdir build
cd build
cmake .. -G"Visual Studio 14 2015 Win64" -DCMAKE_INSTALL_PREFIX=D:\dlib_build
cmake --build . --config Release --target install
我的 .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
QMAKE_CXXFLAGS_RELEASE += /arch:AVX
QMAKE_CXXFLAGS += -DDLIB_JPEG_SUPPORT
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();
}
MSVC2015 64bit Release 的编译输出:
D:\dlib_build\include\dlib\config.h:19: Warning: C4005: DLIB_JPEG_SUPPORT
MSVC2015 64 位版本的运行时输出:
程序意外结束...以代码 -1073741795 退出
请注意,我是在重新安装 Windows 后执行此操作的,而在此之前我遇到了完全相同的问题。
我该如何解决这个问题,或者如何在 Windows 上的 Qt 中使用 dlib?
【问题讨论】:
-
请发布完整的 main(),你也从 main 中返回任何东西吗?
-
@Mikhail 感谢您的回复,现在我发布了带有完整 main() 的完整 main.cpp。
-
那么,你能把main()中的qt部分代码去掉吗?对于最小的可重现示例似乎没有必要。还有你用的是什么CPU?
-
是否有可能在构建的应用程序文件夹中没有 DLL?
-
@fassl 但是哪个 dll?我静态链接了 dlib。
标签: c++ qt visual-c++ gnu dlib