QtCreator, OpenCV in Windows 10

  • Hello forum,

    I have installed and configured QtCreator, OpenCV on windows 10 and compiled sample OpenCV application with success. Then I need to incorporate the windows debugger by installing the visual studio component - Windows SDK. After the installation I point to the auto detected debugger in QtCreator and then the very same sample application that used to run does not compile any more and having the following error while trying to compile:

    C:\Users\si3699\Documents\CustomInstallation\ComputerVision\opencv\build\include\opencv2\core\types_c.h:55: error: C1083: Cannot open include file: 'assert.h': No such file or directoryyour code here

    The whole source code is shown below:

    #include<conio.h>           // may have to modify this line if not using Windows
    using namespace std;
    int main() {
        cv::Mat imgOriginal;        // input image
        cv::Mat imgGrayscale;       // grayscale of input image
        cv::Mat imgBlurred;         // intermediate blured image
        cv::Mat imgCanny;           // Canny edge image
        imgOriginal = cv::imread("alten.jpg");          // open image
        if (imgOriginal.empty()) {                                  // if unable to open image
            std::cout << "error: image not read from file\n\n";     // show error message on command line
            _getch();                                               // may have to modify this line if not using Windows
            return(0);                                              // and exit program
        cv::cvtColor(imgOriginal, imgGrayscale, CV_BGR2GRAY);       // convert to grayscale
        cv::GaussianBlur(imgGrayscale,          // input image
            imgBlurred,                         // output image
            cv::Size(5, 5),                     // smoothing window width and height in pixels
            1.5);                               // sigma value, determines how much the image will be blurred
        cv::Canny(imgBlurred,           // input image
            imgCanny,                   // output image
            100,                        // low threshold
            200);                       // high threshold
                                            // declare windows
        cv::namedWindow("imgOriginal", CV_WINDOW_AUTOSIZE);     // note: you can use CV_WINDOW_NORMAL which allows resizing the window
        cv::namedWindow("imgCanny", CV_WINDOW_AUTOSIZE);        // or CV_WINDOW_AUTOSIZE for a fixed size window matching the resolution of the image
                                                                // CV_WINDOW_AUTOSIZE is the default
        cv::imshow("imgOriginal", imgOriginal);     // show windows
        cv::imshow("imgCanny", imgCanny);
        cv::waitKey(0);                 // hold windows open until user presses a key

    Some hint is requested to get around this issue.


    used to

  • Moderators

    You are most probably mixing compilers here (earlier you compiled OpenCV and Qt using MinGW, now you try to use MinGW libs with Visual Studio compiler - that won't work because they are incompatible).

  • No I did not. I compiled OpenCV using MSVS 2015. I used the manual found at

    Installation Manual

  • Moderators

    OK, from what I gather from this and this it might be that you either did not run install on OpenCV (which should not be necessary), or you miss some includes, please try adding them to INCLUDEPATH in .pro file.

    I'm only guessing, though ;-)

  • Here goes the contents of the .pro file:

    TEMPLATE = app
    CONFIG += console c++11
    CONFIG -= app_bundle
    CONFIG -= qt
    INCLUDEPATH += C:\\Users\\si3699\\Documents\\CustomInstallation\\ComputerVision\\opencv\\build\\include
    LIBS += -LC:\\Users\\si3699\\Documents\\CustomInstallation\\ComputerVision\\opencv\\mybuild\\lib\\Debug \
        -lopencv_calib3d2413d \
        -lopencv_contrib2413d \
        -lopencv_core2413d \
        -lopencv_features2d2413d \
        -lopencv_flann2413d \
        -lopencv_haartraining_engined \
        -lopencv_highgui2413d \
        -lopencv_imgproc2413d \
        -lopencv_legacy2413d \
        -lopencv_ml2413d \
        -lopencv_nonfree2413d \
        -lopencv_objdetect2413d \
        -lopencv_photo2413d \
        -lopencv_stitching2413d \
        -lopencv_superres2413d \
        -lopencv_ts2413d \
        -lopencv_video2413d \
    SOURCES += main.cpp

  • @sierdzio I have already installed OpenCV by CMake using the MSVS 2015 compiler.

  • Moderators

    No idea then, sorry.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.