gpt4 book ai didi

c++ - Qt Windows 上的 dlib。程序意外结束

转载 作者:行者123 更新时间:2023-11-30 03:40:13 25 4
gpt4 key购买 nike

我尝试在 Windows 上的 Qt 项目中使用 dlib。下载后我在 dlib 根目录下做了这个:

cd examples
mkdir build
cd build
cmake .. -G"Visual Studio 14 2015 Win64"
cmake --build . --config Release

还有这个(再次在 dlib root 中):

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

主要.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 64 位版本的编译输出:

D:\dlib_build\include\dlib\config.h:19: Warning: C4005: DLIB_JPEG_SUPPORT

MSVC2015 64 位版本的运行时输出:

The program has unexpectedly finished... Exited with code -1073741795

请注意,我是在重新安装 Windows 后执行此操作的,在此之前我遇到了完全相同的问题。

如何解决这个问题或如何在 Windows 上的 Qt 中使用 dlib?

最佳答案

因为您没有看到异常输出 - 问题应该在 /arch:AVX 部分。可能是您的处理器不支持 AVX 指令。在 x64 模式下,SSE2 将自动启用

试试这个 .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

无需重建示例和 dlib。-DDLIB_JPEG_SUPPORT 已删除,因为您有 C4005 警告。

你离成功只差一步!

关于c++ - Qt Windows 上的 dlib。程序意外结束,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38216510/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com