https://forum.qt.io/topic/69007/compile-dlib-on-windows

 

I try to use dlib in Qt project on Windows. After downloading I did this in the dlib root:

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

And this(again in 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

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:

#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:

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

Runtime output for MSVC2015 64bit Release:

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

Please note that I did this after Windows reinstalling, and before this I got absolutely the same issue.

How can I solve this or how can I use dlib in Qt on Windows?

Posted by uniqueone
,