executable runs fine from local directory / throws error with IDE.
-
My program has gone backwards. It seemed to be doing fine but not now:
The routine is a simple show photo written in qt/opencv.
It builds the executable but when it runs it from the IDE it throws an error and has to close.
If I run the executable from its build directory it works fine, every time and every time I rebuild a new project of it.
I've tried retracing my steps to the time before the error throwing appear. I've started and restarted the program editing as well. Is my installation corrupted now? QTCreator has stalled/frozen on some builds.
-
Hi,
you should verify the QT Creator "Run" settings for your Project.
If you're able to run the program manually it means that the build is correct; probably in the "Run" settings some environmental settings are incorrect -
I haven't changed the run section at all that I can think of. My path= may have something incorrect, and am posting it:
It is bloated and much of it unnecessary, but here is:
C:\Qt\5.4\mingw491_32\bin;C:\Qt\Tools\mingw491_32\bin;%OPENCV%\build\x86\vc11\bin;C:\OpenCV-2.3.1\install\include\opencv;C:\OpenCV-2.3.1\bin;C:\OpenCV-2.3.1\install;C:\opencv-win\opencv\build\include\opencv2\core; c:\OpenCV-2.3.1\bin;C:\opencv-win\opencv\sources\modules;C:\Qt\5.4\mingw491_32\bin;C:\Qt\Tools\mingw491_32\bin;C:\Qt\5.4\mingw491_32\bin;C:\Users\Technologist;C:\Qt\Tools\QtCreator\bin;C:\OpenCV-2.3.1\bin;
Now HelloWorld (as a test) isn't working either. C:\Users\Technologist\Documents\AnotherNewOne\main.cpp:
1: error: qapplication.h: No such file or directory#include <qapplication.h>
Straight from the tutorial:
Qt Tutorial - Chapter 1: Hello, World!
qapplication.h : I did a system wide search for the file with no luck.Its all related I think
-
Hi,
Do you have a link to that tutorial ? In any case, you should use the QApplication include, that's the official supported way to do the includes
-
@Technologist You started a thread with a problem related to an executable runnable manually but not using the IDE and after you started talking about code from a (BAD or OLD) tutorial.
This is a little bit confusing for people that want to help you.
Please focus on the initial problem.What I can see from the path you posted I think the OpenCV is built with Visual C++; so you have to check that is built for 32bit platform
-
Sorry that was unintentional. I don't want to waste anyone's time.The old code compiled created the executable that successfully ran outside of the IDE. Was trying to relate different parts of the problem. Bottom line: am still having issues with the executable working outside the IDE but not within it, and hellonotepad not working making me think the two are related. Helloworld was to test this hypothesis. The build - it was done 32 bit compiler - using cmake. That fact that both simple programs wont work makes me wonder whether reinstall would be good ro to just hang in there.
Hellonotepad link:
https://web.njit.edu/all_topics/Prog_Lang_Docs/html/qt/tutorial1-01.html#include <QApplication> 2 #include <QTextEdit> 3 4 int main(int argv, char **args) 5 { 6 QApplication app(argv, args); 7 8 QTextEdit textEdit; 9 textEdit.show(); 10 11 return app.exec(); 12 }
.pro file -> nothing unusual
C:\Users\Technologist\Documents\simpleapp\main.cpp:1: error: QApplication: No such file or directory
#include <QApplication>Thanks for your time.
-
No problem,
the link you posted refers to avery old Qt version (3.0.5).
Can you post the CMakeLists.txt?? If the compiler doesn't findQApplication
something is not set correctly on the CMakeLists.txt -
Sorry I have cmakelists.txt everywhere it seems. What is t he most relevant dir to pull it from?
Would a makefile from the release directory of the program be helpful?
-
The one you using to build the example
-
Can you please be more specific. In the build directory for the app there are no cmakelists.txt. I am really just learning this particular aspect of programming. Makefiles in the build directory. "Run and Build"-->I don't know where to make file is ...
-
HI,
you said you're using CMake, so you should post the CMakeLists.txt in the source directory
-
I used CMake to build the library, use qmake to build and run projects via the green button.
Ok I found a cmakelists.txt in the source directory of the opencv build, but too large to paste.
The next make file was in the program directory.############################################################################# # Makefile for building: simpleapp # Generated by qmake (3.0) (Qt 5.4.1) # Project: ..\simpleapp\simpleapp.pro # Template: app # Command: C:\Qt\5.4\mingw491_32\bin\qmake.exe -spec win32-g++ -o Makefile ..\simpleapp\simpleapp.pro ############################################################################# MAKEFILE = Makefile first: release install: release-install uninstall: release-uninstall QMAKE = C:\Qt\5.4\mingw491_32\bin\qmake.exe DEL_FILE = del CHK_DIR_EXISTS= if not exist MKDIR = mkdir COPY = copy /y COPY_FILE = $(COPY) COPY_DIR = xcopy /s /q /y /i INSTALL_FILE = $(COPY_FILE) INSTALL_PROGRAM = $(COPY_FILE) INSTALL_DIR = $(COPY_DIR) DEL_FILE = del SYMLINK = copy /y DEL_DIR = rmdir MOVE = move SUBTARGETS = \ release \ debug release: FORCE $(MAKE) -f $(MAKEFILE).Release release-make_first: FORCE $(MAKE) -f $(MAKEFILE).Release release-all: FORCE $(MAKE) -f $(MAKEFILE).Release all release-clean: FORCE $(MAKE) -f $(MAKEFILE).Release clean release-distclean: FORCE $(MAKE) -f $(MAKEFILE).Release distclean release-install: FORCE $(MAKE) -f $(MAKEFILE).Release install release-uninstall: FORCE $(MAKE) -f $(MAKEFILE).Release uninstall debug: FORCE $(MAKE) -f $(MAKEFILE).Debug debug-make_first: FORCE $(MAKE) -f $(MAKEFILE).Debug debug-all: FORCE $(MAKE) -f $(MAKEFILE).Debug all debug-clean: FORCE $(MAKE) -f $(MAKEFILE).Debug clean debug-distclean: FORCE $(MAKE) -f $(MAKEFILE).Debug distclean debug-install: FORCE $(MAKE) -f $(MAKEFILE).Debug install debug-uninstall: FORCE $(MAKE) -f $(MAKEFILE).Debug uninstall Makefile: ../simpleapp/simpleapp.pro ../../../../Qt/5.4/mingw491_32/mkspecs/win32-g++/qmake.conf ../../../../Qt/5.4/mingw491_32/mkspecs/features/spec_pre.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/qdevice.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/device_config.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/common/shell-win32.conf \ ../../../../Qt/5.4/mingw491_32/mkspecs/qconfig.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_axbase.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_axbase_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_axcontainer.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_axcontainer_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_axserver.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_axserver_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_bluetooth.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_bluetooth_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_bootstrap_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_clucene_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_concurrent.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_concurrent_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_core.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_core_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_dbus.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_dbus_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_declarative.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_declarative_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_designer.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_designer_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_designercomponents_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_enginio.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_enginio_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_gui.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_gui_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_help.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_help_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_location.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_location_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_multimedia.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_multimedia_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_multimediawidgets.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_multimediawidgets_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_network.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_network_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_nfc.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_nfc_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_opengl.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_opengl_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_openglextensions.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_openglextensions_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_platformsupport_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_positioning.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_positioning_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_printsupport.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_printsupport_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_qml.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_qml_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_qmldevtools_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_qmltest.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_qmltest_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_quick.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_quick_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_quickparticles_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_quickwidgets.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_quickwidgets_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_script.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_script_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_scripttools.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_scripttools_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_sensors.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_sensors_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_serialport.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_serialport_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_sql.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_sql_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_svg.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_svg_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_testlib.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_testlib_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_uitools.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_uitools_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_webchannel.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_webchannel_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_webkit.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_webkit_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_webkitwidgets.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_webkitwidgets_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_websockets.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_websockets_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_webview.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_webview_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_widgets.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_widgets_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_winextras.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_winextras_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_xml.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_xml_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_xmlpatterns.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/modules/qt_lib_xmlpatterns_private.pri \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/qt_functions.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/qt_config.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/win32/qt_config.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/win32-g++/qmake.conf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/spec_post.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/exclusive_builds.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/default_pre.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/win32/default_pre.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/resolve_config.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/exclusive_builds_post.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/default_post.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/win32/console.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/win32/rtti.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/precompile_header.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/warn_on.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/qt.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/resources.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/moc.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/testcase_targets.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/exceptions.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/yacc.prf \ ../../../../Qt/5.4/mingw491_32/mkspecs/features/lex.prf \ ../simpleapp/simpleapp.pro \ C:/Qt/5.4/mingw491_32/lib/Qt5Core.prl $(QMAKE) -spec win32-g++ -o Makefile ..\simpleapp\simpleapp.pro ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\spec_pre.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\qdevice.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\device_config.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\common\shell-win32.conf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\qconfig.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_axbase.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_axbase_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_axcontainer.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_axcontainer_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_axserver.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_axserver_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_bluetooth.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_bluetooth_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_bootstrap_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_clucene_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_concurrent.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_concurrent_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_core.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_core_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_dbus.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_dbus_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_declarative.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_declarative_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_designer.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_designer_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_designercomponents_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_enginio.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_enginio_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_gui.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_gui_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_help.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_help_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_location.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_location_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_multimedia.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_multimedia_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_multimediawidgets.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_multimediawidgets_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_network.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_network_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_nfc.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_nfc_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_opengl.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_opengl_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_openglextensions.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_openglextensions_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_platformsupport_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_positioning.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_positioning_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_printsupport.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_printsupport_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_qml.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_qml_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_qmldevtools_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_qmltest.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_qmltest_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_qtmultimediaquicktools_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_quick.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_quick_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_quickparticles_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_quickwidgets.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_quickwidgets_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_script.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_script_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_scripttools.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_scripttools_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_sensors.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_sensors_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_serialport.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_serialport_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_sql.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_sql_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_svg.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_svg_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_testlib.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_testlib_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_uitools.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_uitools_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_webchannel.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_webchannel_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_webkit.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_webkit_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_webkitwidgets.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_webkitwidgets_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_websockets.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_websockets_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_webview.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_webview_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_widgets.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_widgets_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_winextras.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_winextras_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_xml.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_xml_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_xmlpatterns.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\modules\qt_lib_xmlpatterns_private.pri: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\qt_functions.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\qt_config.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\win32\qt_config.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\win32-g++\qmake.conf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\spec_post.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\exclusive_builds.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\default_pre.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\win32\default_pre.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\resolve_config.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\exclusive_builds_post.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\default_post.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\win32\console.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\win32\rtti.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\precompile_header.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\warn_on.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\qt.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\resources.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\moc.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\testcase_targets.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\exceptions.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\yacc.prf: ..\..\..\..\Qt\5.4\mingw491_32\mkspecs\features\lex.prf: ..\simpleapp\simpleapp.pro: C:/Qt/5.4/mingw491_32/lib/Qt5Core.prl: qmake: FORCE @$(QMAKE) -spec win32-g++ -o Makefile ..\simpleapp\simpleapp.pro qmake_all: FORCE make_first: release-make_first debug-make_first FORCE all: release-all debug-all FORCE clean: release-clean debug-clean FORCE distclean: release-distclean debug-distclean FORCE -$(DEL_FILE) Makefile release-mocclean: $(MAKE) -f $(MAKEFILE).Release mocclean debug-mocclean: $(MAKE) -f $(MAKEFILE).Debug mocclean mocclean: release-mocclean debug-mocclean release-mocables: $(MAKE) -f $(MAKEFILE).Release mocables debug-mocables: $(MAKE) -f $(MAKEFILE).Debug mocables mocables: release-mocables debug-mocables check: first FORCE: $(MAKEFILE).Release: Makefile $(MAKEFILE).Debug: Makefile
-
Hi @Technologist,
Let's take a step back. Do an officially-supported Hello World test:
- Open Qt Creator
- Create a new project: "File" -> "New File or Project..." -> "Application" -> "Qt Widgets Application"
- Click the green button.
Does this work? If so, examine the .pro file and look for differences with yours.
-
Ok, I built the "official" hello world app which worked flawlessly. The #include <QApplication>
didn't throw an error.I ran the "Unofficial" hello world and compilation stopped secondary to error: qapplication.h: No such file or directory
Ive compared both .pro files and I don't see why the unofficial can't find the same include that the "official" hello world can. I'll post
"official" HW .pro file/main
#------------------------------------------------- # # Project created by QtCreator 2015-04-17T08:55:34 # #------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = TestApp TEMPLATE = app SOURCES += main.cpp\ mainwindow.cpp HEADERS += mainwindow.h FORMS += mainwindow.ui main.cpp #include "mainwindow.h" #include <QApplication> int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow w; w.show(); return a.exec(); } "Unofficial" HW File '''
Unofficial Hello world
.pro file - qapp/qbutton not found
QT += core QT -= gui TARGET = HelloWorldUnofficialvsTestApp CONFIG += console CONFIG -= app_bundle TEMPLATE = app SOURCES += main.cpp #include <qapplication.h> #include <qpushbutton.h> int main( int argc, char **argv ) { QApplication a( argc, argv ); QPushButton hello( "Hello world!", 0 ); hello.resize( 100, 30 ); a.setMainWidget( &hello ); hello.show(); return a.exec(); }
-
@Technologist said:
Ive compared both .pro files and I don't see why the unofficial can't find the same include that the "official" hello world can.
By default, the Qt Core and Qt GUI modules are available for your project. Let's see how the .pro files change this.
"official" HW .pro file
QT += widgets
This line says, "ADD the Qt Widgets module to my project". This is required to find QApplication and QPushButton, because they belong to the Qt Widgets module. They used to be in the Qt GUI module in Qt 4, but Qt 5 has a new structure. This is one big reason to avoid old tutorials and stick to new ones.
Unofficial Hello world
QT -= gui
This line says, "EXCLUDE the Qt GUI module from my project". This removes all GUI functionality, like OpenGL. Since you want to build an OpenCV app, you probably don't want this option!
See https://doc.qt.io/qt-5/qtmodules.html for a list of all available modules.
-
That shows that the configuration problem of .pro file was human error. It found my qt header files. Thanks for the pointer on opel GL etc. This solution rules out a single error behind both. This problem is fixed however the first problem persists: the IDE crashes when I build the "Show Picture" routine, but runs perfectly when I execute it from build directory. Do I need to close out this ticket and reopen it or finish out here?
Thanks for your time
-
@Technologist said:
That shows that the configuration problem of .pro file was human error. It found my qt header files. Thanks for the pointer on opel GL etc. This solution rules out a single error behind both. This problem is fixed however the first problem persists: the IDE crashes when I build the "Show Picture" routine, but runs perfectly when I execute it from build directory. Do I need to close out this ticket and reopen it or finish out here?
Thanks for your time
You're welcome :)
Yes, this little excursion helped us to establish that your installation of Qt and the IDE are fine. So, the problem probably lies in your project configuration or environment.
I just noticed that you have Qt and Qt Creator in your PATH. This is very bad, because they both contain different (and incompatible) versions of the same DLL (e.g. Qt5Core.dll). Remove them from your PATH. There is no need for anything Qt-related to be in the PATH, and having them there is the cause of many mysterious crashes.
After cleaning your PATH, try running your program again. (To do it outside the IDE the proper way, see http://wiki.qt.io/Deploy_an_Application_on_Windows )
In general, MSVC and MinGW are incompatible. Qt Creator is a Qt-built program too, which uses MSVC 2010-built Qt DLLs. I also noticed that your copy OpenCV is built with MSVC 2012. I'm not sure if this is compatible with your MinGW-built app.
You can continue posting here, as it's still about your original post.
-
FYI the platform was built using cmake and mingw, not MSVS (I don't have msvs on the system.) -- if that's coming across from the ?path?. Was it this line: %OPENCV%\buildx86\vc11Honestly I think I put it in the path mistakenly. Can I remove it?
OK cleaned my path. No more missing qt files with Widgets addition to pro file. Application still continue to crash in intialization phase. Sometimes it will throw this error a lot of the time or just open a window and crash. Below it can't find an opencv file.
The program can't start because libgcc_s_dw2-1.dll is missing from your computer Try installing the program to fix this problem.
New local path:
C:\OpenCV-2.3.1\bin;C:\OpenCV-2.3.1\install\include\opencv2;C:\OpenCV-2.3.1\lib;
System path:%OPENCV%\build\x86\vc11\bin; c:\OpenCV-2.3.1\bin;C:\opencv-win\opencv\sources\modules;
error :
C:\Users\Technologist\Documents\NewOne\main.cpp:2: error: opencv2/core/core.hpp: No such file or directory #include <opencv2/core/core.hpp>
^
pro. file:QT += core QT += gui QT += widgets TARGET = NewOne CONFIG += console CONFIG -= app_bundle TEMPLATE = app SOURCES += main.cpp INCLUDEPATH += "C:/OpenCV-2.3.1/install/include/opencv2/" LIBS += -LC:\OpenCV-2.3.1\lib\ -lopencv_core2411.dll.a \ -lopencv_highgui2411.dl.al \ -lopencv_imgproc2411.dll.a \ -lopencv_features2d2411.dll.a \ -lopencv_calib3d2411.dll.a
#include <QCoreApplication> #include <opencv2/core/core.hpp> #include <opencv2/highgui/highgui.hpp> int main() { // read an image cv::Mat image= cv::imread("img.jpg"); // create image window named "My Image" cv::namedWindow("My Image"); // show the image on window cv::imshow("My Image", image); // wait key for 5000 ms cv::waitKey(5000); return 1; }
-
Don't include opencv2 in your INCLUDEPATH entry
INCLUDEPATH += "C:/OpenCV-2.3.1/install/include/"
-
I don't see any opencv2 in your includepath unless you are referring to the opencv2 down the file directory from there.
INCLUDEPATH += "C:\OpenCV-2.3.1\install\include\opencv2"
Sorry, now I am feeling newbish.