I've installed Qt Open source 4.8.3 library for Windows on Windows 8 Pro x64, Qt Creator 2.6.0 and MingW 4.4.0 manually. From Qt Creator I've setup kits and compilers. I opened the analog clock example comes along with Qt Creator and rebuild the project. The following error are emitted by the compiler.
Running steps for project analogclock...
Starting: "C:\Qt\4.8.3\bin\qmake.exe" C:\Qt\4.8.3\examples\widgets\analogclock\analogclock.pro -r -spec win32-g++
The process "C:\Qt\4.8.3\bin\qmake.exe" exited normally.
Starting: "C:\MingW\bin\mingw32-make.exe"
C:/MingW/bin/mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `C:/Qt/4.8.3/examples/widgets/analogclock-build-Desktop-Release'
g++ -c -O2 -Wall -Wextra -fno-exceptions -fno-rtti -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -DQT_NO_DYNAMIC_CAST -I"..\..\..\include\QtCore" -I"..\..\..\include\QtGui" -I"..\..\..\include" -I"..\..\..\include\ActiveQt" -I"release" -I"..\analogclock" -I"." -I"..\..\..\mkspecs\win32-g++" -o release\analogclock.o **..\analogclock\analogclock.cpp**
mingw32-make[1]: Leaving directory `C:/Qt/4.8.3/examples/widgets/analogclock-build-Desktop-Release'
mingw32-make[1]: *** [release/analogclock.o] Error 1
mingw32-make: *** [release] Error 2
The process "C:\MingW\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project analogclock (target: Desktop)
When executing step 'Make'
I've verified that C:/Qt/4.8.3/examples/widgets/analogclock/analogclock.cpp exists. Besides, this project comes with Qt installation and I didn't change anything.
Why is this error occurring and how can i fix it?
It seems your installation of g++ is not clean, so the compiler cannot be launched (this is also what you've said in the comments). Try reinstall, and then you can try to build a hello world program to verify whether you can run g++. Also, please verify that your PATH variable is properly configured for mingw.
Sounds like a bad mingw installation. Are there any other unix-ish things in your %PATH%, i.e. cygwin, or msys, perl, ruby, ... or other versions of mingw?
Related
win10
QT5.7
I try to compile QT project through cmd
C:\Qt\Qt5.7.1\Examples\Qt-5.7\quick\demos\clocks>qmake -project
C:\Qt\Qt5.7.1\Examples\Qt-5.7\quick\demos\clocks>qmake
C:\Qt\Qt5.7.1\Examples\Qt-5.7\quick\demos\clocks>mingw32-make
output:
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory 'C:/Qt/Qt5.7.1/Examples/Qt-5.7/quick/demos/clocks'
g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=gnu++11 -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I. -I. -IC:\Qt\Qt5.7.1\5.7\mingw53_32\include -IC:\Qt\Qt5.7.1\5.7\mingw53_32\include\QtGui -IC:\Qt\Qt5.7.1\5.7\mingw53_32\include\QtANGLE -IC:\Qt\Qt5.7.1\5.7\mingw53_32\include\QtCore -Irelease -IC:\Qt\Qt5.7.1\5.7\mingw53_32\mkspecs\win32-g++ -o release\main.o main.cpp
In file included from main.cpp:40:0:
../../shared/shared.h:42:22: fatal error: QQmlEngine: No such file or directory
compilation terminated.
Makefile.Release:198: recipe for target 'release/main.o' failed
mingw32-make[1]: *** [release/main.o] Error 1
mingw32-make[1]: Leaving directory 'C:/Qt/Qt5.7.1/Examples/Qt-5.7/quick/demos/clocks'
Makefile:34: recipe for target 'release' failed
mingw32-make: *** [release] Error 2
this is the demo example of QT, and it works well at Qt creator. but report error at cmd. and no matter which demo I compile, they all report the same error which starts at ../../shared/shared.h:42:22: fatal error: QQmlEngine: No such file or directory
P.S.:
actually, what I really want to do is to compile Qt project in sublime3, which failed and have no output. I began to use cmd to find the bug, and found out this error
my build system of sublime3 follows this postBuild system for Qt in Sublime Text 3 not working
add .pro file
######################################################################
# Automatically generated by qmake (3.0) ?? 5? 29 09:05:15 2018
######################################################################
TEMPLATE = app
TARGET = clocks
INCLUDEPATH += .
# Input
HEADERS += ../../shared/shared.h
SOURCES += main.cpp
RESOURCES += clocks.qrc
this is what the qt demo writes
update
thanks to the comments, I add QT += qml quick in .pro file and solve the problem. although I don't know why the pro file generated by qmake -project commmand lack that statement
Thanks to the comments, I added QT += qml quick in .pro file and solved the problem.
I am running macOS High Sierra (10.13.2) and Qt 5.10.0. I would like to use OpenMP with my application.
I have added the following flags to my .pro file
QMAKE_CXXFLAGS += -fopenmp
QMAKE_LFLAGS += -fopenmp
LIBS += -fopenmp
The default compilers on macOS do not contain OpenMP. I installed gcc through homebrew which does support OpenMP.
Under the Build & Run -> Compilers tab of Qt Creator, I added the homebrew g++ and gcc compilers (/usr/local/Cellar/gcc/7.2.0/bin/{gcc-7,g++-7}). I then selected the kit that I am using and changed the compiler to be the homebrew installed compiler that I added under the compilers tab.
If I inspect the Makefile generated by Qt Creator after setting this kit and rebuilding the project, I find the CC and CXX are not using the compiler that I have specified.
Here are their values in the Makefile:
CC = /Library/Developer/CommandLineTools/usr/bin/clang
CXX = /Library/Developer/CommandLineTools/usr/bin/clang++
These should be /usr/local/Cellar/gcc/7.2.0/bin/g++-7 and /usr/local/Cellar/gcc/7.2.0/bin/gcc-7.
The compiler output that I get now is:
18:14:48: Starting: "/usr/bin/make"
/usr/local/Cellar/qt/5.10.0/bin/qmake -o Makefile ../Practice/Practice.pro -spec macx-g++ CONFIG+=debug CONFIG+=x86_64 CONFIG+=qml_debug
/Library/Developer/CommandLineTools/usr/bin/g++ -c -pipe -fopenmp -g -std=gnu++11 -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdk -mmacosx-version-min=10.10 -Wall -W -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_QUICK_LIB -DQT_GUI_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -I../Practice -I. -I/usr/local/Cellar/qt/5.10.0/lib/QtQuick.framework/Headers -I/usr/local/Cellar/qt/5.10.0/lib/QtGui.framework/Headers -I/usr/local/Cellar/qt/5.10.0/lib/QtQml.framework/Headers -I/usr/local/Cellar/qt/5.10.0/lib/QtNetwork.framework/Headers -I/usr/local/Cellar/qt/5.10.0/lib/QtCore.framework/Headers -I. -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/AGL.framework/Headers -I/usr/local/Cellar/qt/5.10.0/mkspecs/macx-g++ -F/usr/local/Cellar/qt/5.10.0/lib -o main.o ../Practice/main.cpp
clang: error: unsupported option '-fopenmp'
make: *** [main.o] Error 1
18:14:49: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project Practice (kit: Desktop)
When executing step "Make"
Why is the Makefile generated by Qt Creator not using the compiler that I am specifying in the kit that I am using?
Because the mkspec macx-g++ you're using will override CC and CXX settings. As a temporary workaround, try setting them in the pro file directly:
QMAKE_CC = /usr/local/Cellar/gcc/7.2.0/bin/gcc-7
QMAKE_CXX = /usr/local/Cellar/gcc/7.2.0/bin/g++-7
You may want to edit the mkspec (or making a new one) for your kit and set those variables there.
To find the mkspec file (qmake.conf):
INSTALLDIR=`qmake -query QT_INSTALL_CONFIGURATION`
MKSPECNAME=`qmake -query QMAKE_SPEC`
cd $INSTALLDIR/mkspecs/$MKSPECNAME
As to why you have to set the compilers twice: Qt Creator is meant to be a generic c++ IDE, thus able to manage non-Qt projects, which don't use qmake but need a compiler anyway.
so while trying to assist a friend in setting up QT I ran into a odd problem with his system. Whenever he attempts to build a simple 'Hello World' app through QTCreator using all the default settings, he gets some odd compiler output diffrent to my own. I know for a fact that his install, and project setup was done verbatim exactly as I did it, I even had him uninstall and reinstall along side me to test that.
Everything with QtCreator works out of the box on my end, and I after a few hours of uninstalling / reinstalling on both machines via remote control I am out of ideas.
HIS COMPILER OUTPUT
01:33:52: Running steps for project untitled...
01:33:52: Starting: "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" clean
C:/Qt/Tools/mingw530_32/bin/mingw32-make -f Makefile.Debug clean
mingw32-make[1]: Entering directory 'C:/Users/gian_/Documents/untitled'
del debug\main.o
mingw32-make[1]: Leaving directory 'C:/Users/gian_/Documents/untitled'
C:/Qt/Tools/mingw530_32/bin/mingw32-make -f Makefile.Release clean
mingw32-make[1]: Entering directory 'C:/Users/gian_/Documents/untitled'
del release\main.o
Could Not Find C:\Users\gian_\Documents\untitled\release\main.o
mingw32-make[1]: Leaving directory 'C:/Users/gian_/Documents/untitled'
01:33:52: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited normally.
01:33:52: Configuration unchanged, skipping qmake step.
01:33:52: Starting: "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe"
C:/Qt/Tools/mingw530_32/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'C:/Users/gian_/Documents/untitled'
g++ -c -fno-keep-inline-dllexport -pipe -g -std=gnu++11 -Wextra -Wall -W -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG -I. -I..\..\..\..\Qt\5.9.1\mingw53_32\mkspecs\win32-g++ -o debug\main.o main.cpp
g++ -Wl,-subsystem,console -mthreads -o debug\untitled.exe debug/main.o
mingw32-make[1]: Leaving directory 'C:/Users/gian_/Documents/untitled'
01:33:53: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited normally.
01:33:53: Elapsed time: 00:01.
MY COMPILER OUTPUT
00:21:00: Running steps for project untitled3...
00:21:00: Starting: "C:\Qt\5.9.1\mingw53_32\bin\qmake.exe" C:\Users\jay\Documents\untitled3\untitled3.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
Info: creating stash file C:\Users\jay\Documents\build-untitled3-Desktop_Qt_5_9_1_MinGW_32bit-Debug\.qmake.stash
00:21:00: The process "C:\Qt\5.9.1\mingw53_32\bin\qmake.exe" exited normally.
00:21:00: Starting: "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" qmake_all
mingw32-make: Nothing to be done for 'qmake_all'.
00:21:00: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited normally.
00:21:00: Starting: "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe"
C:/Qt/Tools/mingw530_32/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'C:/Users/jay/Documents/build-untitled3-Desktop_Qt_5_9_1_MinGW_32bit-Debug'
g++ -c -fno-keep-inline-dllexport -pipe -g -std=gnu++11 -Wextra -Wall -W -fexceptions -mthreads -DUNICODE -DQT_QML_DEBUG -I..\untitled3 -I. -I..\..\..\..\Qt\5.9.1\mingw53_32\mkspecs\win32-g++ -o debug\main.o ..\untitled3\main.cpp
g++ -Wl,-subsystem,console -mthreads -o debug\untitled3.exe debug/main.o
mingw32-make[1]: Leaving directory 'C:/Users/jay/Documents/build-untitled3-Desktop_Qt_5_9_1_MinGW_32bit-Debug'
00:21:01: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited normally.
00:21:01: Running steps for project untitled1...
00:21:01: Configuration unchanged, skipping qmake step.
00:21:01: Starting: "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe"
C:/Qt/Tools/mingw530_32/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'C:/Users/jay/Documents/build-untitled1-Desktop_Qt_5_9_1_MinGW_32bit-Debug'
mingw32-make[1]: Nothing to be done for 'first'.
mingw32-make[1]: Leaving directory 'C:/Users/jay/Documents/build-untitled1-Desktop_Qt_5_9_1_MinGW_32bit-Debug'
00:21:01: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited normally.
00:21:01: Elapsed time: 00:01.
I could not find any other issues like this, I have tried searching.
QtCreator will not build 'Hello World'
QtCreator build failed mingw
QtCreator not building with qmake.exe
QtCreator build error using MinGW
Thank you to anyone who takes the time to look this over.
EDIT: I was asked to provide our Envrioment Variables, so here you go.
His Environment Vars
My Environment Vars
SOLVED
So, after much issue we discovered that the description was he was getting messages in his build in regards to his "RELEASE" settings as well, we still have not solved the issue as to why his build chain is different, even though we have identical setups.
So to anyone who MAY have this issue, simply build in debug, build in release, then switch back to debug and run it, worked for my friend.
I set up NetBeans 8.1 on Linux Mint to compile C/C++. Everything went fine at first, until I tried using C++14.
I changed the settings for C++ from C++98 to C++11. There was an error in the program which I fixed. I got distracted and changed the settings again to use C++14. g++, or at least the version I have installed, does not support C++14, so I changed it back to C++11, but it's still using C++14 of its own accord. I tried changing it to C++11 and back again, and then to C++11 again. C++11 works for sure, because I've used that tag with success in the past.
Here is the build log:
cd '/home/.../NetBeansProjects/Sun Storm'
/usr/bin/make -f Makefile CONF=Debug
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/.../NetBeansProjects/Sun Storm'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux/sun_storm
make[2]: Entering directory `/home/.../NetBeansProjects/Sun Storm'
mkdir -p build/Debug/GNU-Linux
rm -f "build/Debug/GNU-Linux/main.o.d"
g++ -c -g -std=c++14 -MMD -MP -MF "build/Debug/GNU-Linux/main.o.d" -o build/Debug/GNU-Linux/main.o main.cpp
g++: error: unrecognized command line option ‘-std=c++14’
make[2]: *** [build/Debug/GNU-Linux/main.o] Error 1
make[2]: Leaving directory `/home/.../NetBeansProjects/Sun Storm'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/home/.../NetBeansProjects/Sun Storm'
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 76ms)
By seeing g++ -c -g -std=c++14, it is safe to assume that NetBeans is still using C++14, even though it is set to use C++11. How can I get NetBeans to use the settings that are actually there instead of making them up on its own?
Note: I couldn't find anything on the Internet about NetBeans not following the given settings.
I also tried deactivating the C/C++ plugin, restarting the IDE, and then activating it again. I also tried installing the GNU Standard C++ Library v3. Nothing changed.
Have you tried to change your "g++" call to devtoolset-2 ?
File->Project Properties -> Build -> Tools Colection->
Click in Version and you will see with compilers Netbeans is using
++++++++++++++++++++++++++++++++++++++++++++++++++++
C Compiler: gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-17)
C++ Compiler: g++ (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
Fortran Compiler: Tool not found
Assembler: GNU assembler version 2.20.51.0.2-5.44.el6 20100205
Make Tool: GNU Make 3.81
Debugger: Tool not found
QMake Tool: Tool not found
CMake Tool: Tool not found
++++++++++++++++++++++++++++++++++++++++++++++++++++
I have a stub Qt application and I keep getting compiler errors
#include <QApplication>
int main(int argc, char *argv[])
{
return 0;
}
I used qmake -project and qmake commands and as far as I can tell
they did their job correctly. When I subsequently call make at the command
line I get the following error:
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT
-DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I
'../../../../qt/include/QtCore' -I'../../../../qt/include/QtCore' -I'../../../..
/qt/include/QtGui' -I'../../../../qt/include/QtGui' -I'../../../../qt/include' -
I'.' -I'c:/qt/include/ActiveQt' -I'release' -I'.' -I'../../../../qt/mkspecs/defa
ult' -o release/Main.o Main.cpp
cc1plus.exe: Invalid option 'threads'
make[1]: *** [release/Main.o] Error 1
make: *** [release] Error 2
My searches on Google tell me that threading is important to keep but not how to
fix this error. Any help will be appreciated.
EDIT (copied from an answer the OP left):
I now get:
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-rel oc
-Wl,-s -pthread -Wl -Wl,-subsystem,windows -o release/raytrace.exe
object_scr ipt.raytrace.Release -L'c:/qt/lib' -lmingw32 -lqtmain -lQtGui -lgdi32
-lcomdlg3 2 -loleaut32 -limm32 -lwinmm -lwinspool -lmsimg32 -lQtCore -lkernel32
-luser32 - lshell32 -luuid -lole32 -ladvapi32 -lws2_32
g++: unrecognized option `-pthread'
/cygnus/cygwin-b20/H-i586-cygwin32/i586-cygwin32/bin/ld: cannot open -lmsimg32:
No such file or directory collect2:
ld returned 1 exit status make[1]: ***
[release/raytrace.exe] Error 1 make: *** [release] Error 2
++milot
I only use MinGW to compile Qt on Windows and that's the easiest way to make sure you have everything you need.
Here is the link for the Open Source Qt version:
http://trolltech.com/downloads/opensource/appdev/windows-cpp
Use the "Or download Qt with the MinGW compiler included: Size: 149,3 Mb" link.
The other way to use MinGW is to compile Qt with MinGW and then compile your application, but it depends on if you're compiling in MSYS or just using MinGW.
Well I had similar problem before when I was installing MingW downloaded from the web, but in the other hand while installing Qt it will ask you to download the version of MingW which is compatible with Qt. So have you tried installing it when the Qt installer asked you?
Qt 4.5 has Qt Creator 1.1 which is easy to develop applications.
Designing and coding is combined in Qt Creator and mucy easier to use.
you can experience it like using VB IDE(or rather like eclipse,netbeans,etc.)
when run the app. the project is compiled in either in debug or release mode.
Based on the later response from the questioner, not the original question.
From the MSYS prompt run "ls /mingw/lib/libmsimg32.a" and see if you have that file. My installation does (MinGW GCC 3.4.5). If you have that file you may need to add -L/mingw/lib. If you don't have the file you may have missed installing the windows api part of MinGW.
Either way remove -pthread. You're using the Win32 api.
If this doesn't work you need to specify which version of MinGW you're using and, if you're using MSYS, which version of MSYS.