So I installed openCV and wanted to make a very basic program with Qt, when I compiled and ran the program it would return a command line window with the message "press <return> to close" and the Qt output panel printed "...exe exited with code 0" ??

I know that it means there were no errors and everything was successful but why didnt it execute the actual code which is suppose to get the cameras video and display it in a new window.

Btw here is my code:

Qt Code:
  1. #include <QCoreApplication>
  2. #include <opencv2/core/core.hpp>
  3. #include <opencv2/highgui/highgui.hpp>
  4.  
  5. #include <QtCore>
  6.  
  7. int main(int argc, char *argv[])
  8. {
  9. QCoreApplication a(argc, argv);
  10.  
  11. cv::VideoCapture cam = cv::VideoCapture(0);
  12. cv::Mat frame;
  13. cv::namedWindow ("Demo", CV_WINDOW_AUTOSIZE);
  14.  
  15. while (1) {
  16. cam >> frame;
  17. imshow ("Demo", frame);
  18. }
  19.  
  20. cam.release();
  21. return 0;
  22.  
  23.  
  24. }
To copy to clipboard, switch view to plain text mode 

And here is my .pro file if it matters:

Qt Code:
  1. QT += core
  2.  
  3. QT -= gui
  4.  
  5. TARGET = WebCam
  6. CONFIG += console
  7. CONFIG -= app_bundle
  8.  
  9. TEMPLATE = app
  10.  
  11.  
  12. SOURCES += main.cpp
  13.  
  14. INCLUDEPATH += "C:\openCV24\opencv_bin\install\include"
  15.  
  16. LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_calib3d240.dll.a"
  17. LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_contrib240.dll.a"
  18. LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_core240.dll.a"
  19. LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_features2d240.dll.a"
  20. LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_flann240.dll.a"
  21. LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_gpu240.dll.a"
  22. LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_highgui240.dll.a"
  23. LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_imgproc240.dll.a"
  24. LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_legacy240.dll.a"
  25. LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_ml240.dll.a"
  26. LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_nonfree240.dll.a"
  27. LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_objdetect240.dll.a"
  28. LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_photo240.dll.a"
  29. LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_stitching240.dll.a"
  30. LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_video240.dll.a"
  31. LIBS += "C:\openCV24\opencv\build\x86\mingw\lib\libopencv_videostab240.dll.a"
To copy to clipboard, switch view to plain text mode 

Thanks appreciate any help to get me up and running