Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Compile dlib on Windows
Qt 6.11 is out! See what's new in the release blog

Compile dlib on Windows

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 4.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • don-progD Offline
    don-progD Offline
    don-prog
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      How did you start your program?
      Most probably it does not find needed libraries.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      don-progD 1 Reply Last reply
      0
      • jsulmJ jsulm

        How did you start your program?
        Most probably it does not find needed libraries.

        don-progD Offline
        don-progD Offline
        don-prog
        wrote on last edited by
        #3

        @jsulm the problem was due to /arch:AVX flag, without it all works fine.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved