Unrecognized Command Line Option '-WI' - c++

I'm trying to set up my Qt for college and I'm running into some issues. I'm running Windows 8, and I'm not sure which version of Qt or QtCreator but not the latest - we were given the version installer so we must use this one, although I did install the latest MinGW myself before the QtCreator setup.
I tried some demo code in QtCreator and I got the error "Unrecognized Command Line Option "-WI" when I try run the following code.
#include <QtCore/QCoreApplication>
#include <QtGui/QMessageBox>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QMessageBox msgBox;
msgBox.setText("This is some text.");
msgBox.exec();
return a.exec();
}
I need to do my assignment and I'm not sure how I can do it when I'm getting all of these strange errors.
Any help would be appreciated.
Thanks in advance!
* EDIT *
This is the error output that I can find in QtCreator during the build process.
Running build steps for project TestProject...
Configuration unchanged, skipping qmake step.
Starting: "C:/MinGW/bin/mingw32-make.exe" -w
mingw32-make: Entering directory 'C:/Users/Nick/Documents/Qt Projects/TestProject-build-desktop'
C:/MinGW/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'C:/Users/Nick/Documents/Qt Projects/TestProject-build-desktop'
g++ -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-subsystem,console -mthreads -Wl -o debug\TestProject.exe debug/main.o -L"c:\Qt\2010.04\qt\lib" -lQtCored4
Makefile.Debug:73: recipe for target 'debug\TestProject.exe' failed
mingw32-make[1]: Leaving directory 'C:/Users/Nick/Documents/Qt Projects/TestProject-build-desktop'
Makefile:34: recipe for target 'debug' failed
mingw32-make: Leaving directory 'C:/Users/Nick/Documents/Qt Projects/TestProject-build-desktop'
g++: error: unrecognized command line option '-Wl'
mingw32-make[1]: *** [debug\TestProject.exe] Error 1
mingw32-make: *** [debug] Error 2
The process "C:/MinGW/bin/mingw32-make.exe" exited with code %2.
Error while building project TestProject (target: Desktop)
When executing build step 'Make'
Here are the contents of the .pro file generated by QtCreator :
QT += core
QT -= gui
TARGET = TestProject
CONFIG += console
CONFIG -= app_bundle
TEMPLATE = app
SOURCES += main.cpp

As Mats says the problem is the extra -Wl in the command line.
This is due to a bug in the QT conf files, and thankfully this can be fixed "permanently" (locally).
You need to edit one (possibly both) of these files (often in C:\Qt\2010.02\qt\mkspecs):
mkspecs\default\qmake.conf
mkspecs\win32-g++\qmake.conf
changing this:
QMAKE_LFLAGS = -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads -Wl
to this:
QMAKE_LFLAGS = -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads
because somehow the -Wl, from the start of the first line is wrongly on the end of the second line.
After this edit, if you clean and then rebuild your project you will no longer see the error.
Notes:
this same bug causes this issue too, so thanks to leemes for his answer there)
it is fixed in Qt since version 4.7 I believe

The problem is clearly:
g++ -enable-stdcall-fixup -Wl,-enable-auto-import
-Wl,-enable-runtime-pseudo-reloc -Wl,-subsystem,console -mthreads -Wl -o debug\TestProject.exe debug/main.o -L"c:\Qt\2010.04\qt\lib" -lQtCored4
I'm not sure exaclty how this is compiled, but to me it looks like a makefile with -Wl${somestuff} and for some reason ${somestuff} is not defined. Either that, or there is a spurious -Wl in the commendline for the link command, but that seems less likely.

Related

make: g++: error: CreateProcess: No such file or directory

I see that this issue has been posted many many times but none of solutions worked for me and my problem is a bit different.
The problem:
When a use a makefile and mingw32-make, I get the error:
g++: error: CreateProcess: No such file or directory
However, if I copy/paste the SAME command that the makefile tried to do and paste it in the SAME command prompt it works. This problem only occurs when I try to build with a makefile.
Here's more info:
g++ ./src/main.cpp ./src/application.cpp -I C:\Code\infographie\Labs\inc -L C:\Code\infographie\Labs\lib -I C:\Code\infographie\Labs\inc -g -Dmain=SDL_main -L C:\Code\infographie\Labs\lib -lmingw32 -lSDL2main -lSDL2 -o bin/debug/labs.exe
g++: error: CreateProcess: No such file or directory
makefile:23: recipe for target 'all' failed
mingw32-make: *** [all] Error 1
As I said, If I copy/paste the first line it will work.
What can I try?
UPDATE: I've installed cygwin, adjusted SDL libs and recompiled. Now I get this error when I try to use make. If I copy/paste the command, it works.
g++ ./src/main.cpp ./src/application.cpp -I C:\Code\infographie\Labs\inc -L C:\Code\infographie\Labs\lib -I C:\Code\infographie\Labs\inc -g -Dmain=SDL_main -L C:\Code\infographie\Labs\lib -lcygwin -lSDL2main -lSDL2 - mwindows -o bin/debug/labs.exe
make: g++: Command not found
make: *** [makefile:23: all] Error 127
FIXED IT, don't declare a variable named PATH...
Stop using MinGW.
MinGW has not been updated since 2013. It has been replaced by Cygwin and
MSYS2. The MinGW project doesn’t even offer a 64-bit compiler.
Cygwin can be installed in about 3 minutes, I would give it a try.

libQt5Core.so: undefined reference to `__cxa_throw_bad_array_new_length#CXXABI_1.3.8

I'm using a cross compiled qt 5.4.2 and I getting the following error when I try to build simple QtWidget app (the app is just a window)
09:55:42: Running steps for project untitled...
09:55:42: Configuration unchanged, skipping qmake step.
09:55:42: Starting: "/usr/bin/make"
g++ --sysroot=/home/pf/ssdk-d6cx/host/usr/x86_64-buildroot-linux-gnu/sysroot -Wl,-O1 -Wl,-rpath,/usr/local/qt5.4-d6cx/lib -o untitled main.o mainwindow.o moc_mainwindow.o -L/home/pf/ssdk-d6cx/host/usr/x86_64-buildroot-linux-gnu/sysroot/usr/local/qt5.4-d6cx/lib -lQt5Widgets -L/home/pf/ssdk-d6cx/host/usr/x86_64-buildroot-linux-gnu/sysroot/lib64 -L/usr/local/qt5.4-d6cx/lib -lQt5Gui -lQt5Core -lGLESv2 -lpthread
/home/pf/ssdk-d6cx/host/usr/x86_64-buildroot-linux-gnu/sysroot/usr/local/qt5.4-d6cx/lib/libQt5Core.so: undefined reference to `__cxa_throw_bad_array_new_length#CXXABI_1.3.8'
collect2: ld returned 1 exit status
make: *** [untitled] Error 1
09:55:42: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project untitled (kit: d6cx)
When executing step "Make"
09:55:42: Elapsed time: 00:00.
I really don't understand what is going on.
Could be a compatibility problem with some libs on the target OS?
I will appreciate any help that point me to the solution.
Thanks in advance.
I found the solution to the problem.
The real problem was that I was using Qt Creator as IDE to cross compile and it set qmake to use a device different that the one I was cross compiling for.
I mean the original setting for qmake was:
qmake '/home/pf/D6Cx/test app/untitled/untitled.pro' -r -spec linux-g++
and it should be:
qmake '/home/pf/D6Cx/test app/untitled/untitled.pro' -r -spec devices/linux-d6cx-g++
whith this last one configuration the app is built correctly!!
The way I use to force qmake to use my specific device was (in Qt Creator):
go to Projects/Build setting
in the section Build Steps -> qmake add in Additional arguments:
-spec devices/linux-d6cx-g++
and that will overwrite the original setting for -spec
Thanks!

Compiling Qt 4.8.5 using mingw32 on windows7: "no such file or directory"

I'm trying to build qt-4.8.5 (opensource) from source using mingw32 compiler on windows 7.
"configure" works fine, but compilation (mingw32-make) fails with this output:
D:\development\qt-4.8.5-mingw>mingw32-make
cd src/tools/bootstrap/ && D:/development/MinGW/bin/mingw32-make.EXE -f Makefile
mingw32-make.EXE[1]: Entering directory 'd:/development/qt-4.8.5-mingw/src/tools/bootstrap'
D:/development/MinGW/bin/mingw32-make.EXE -f Makefile.Release
mingw32-make.EXE[2]: Entering directory 'd:/development/qt-4.8.5-mingw/src/tools/bootstrap'
g++ -c -pipe -fno-keep-inline-dllexport -O2 -frtti -fexceptions -mthreads -Wall -Wextra -DUNICODE -DQT_BOOTSTRAPPED -DQT_LITE_UNICODE -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_CODECS -DQT_NO_DATASTREAM -DQT_NO_GEOM_VARIANT -DQT_NO_LIBRARY -DQT_NO_QOBJECT -DQT_NO_STL -DQT_NO_SYSTEMLOCALE -DQT_NO_TEXTSTREAM -DQT_NO_THREAD -DQT_NO_UNICODETABLES -DQT_NO_USING_NAMESPACE -DQT_NO_DEPRECATED -DQT_NODLL -I'../../../include' -I'../../../include/QtCore' -I'../../../include/QtXml' -I'../../3rdparty/zlib' -I'd:/development/MSVS2008EXP/VC/INCLUDE' -I'd:/development/Microsoft SDKs/Windows/v6.1/include' -I'd:/development/MSVS2008EXP/VC/lib/' -I'd:/development/MS_SDKs/Windows/v6.1/Lib' -I'd:/DXSDK/Lib/x86' -I'../../../mkspecs/win32-g++-4.6' -o tmp/obj/release_shared/qisciicodec.o ../../corelib/codecs/qisciicodec.cpp
g++: error: CreateProcess: No such file or directory
Makefile.Release:333: recipe for target 'tmp/obj/release_shared/qisciicodec.o' failed
mingw32-make.EXE[2]: *** [tmp/obj/release_shared/qisciicodec.o] Error 1
mingw32-make.EXE[2]: Leaving directory 'd:/development/qt-4.8.5-mingw/src/tools/bootstrap'
Makefile:34: recipe for target 'release' failed
mingw32-make.EXE[1]: *** [release] Error 2
mingw32-make.EXE[1]: Leaving directory 'd:/development/qt-4.8.5-mingw/src/tools/bootstrap'
Makefile:68: recipe for target 'sub-tools-bootstrap-make_default-ordered' failed
mingw32-make.EXE: *** [sub-tools-bootstrap-make_default-ordered] Error 2
I.e.:
g++: error: CreateProcess: No such file or directory
Because g++ DOESN'T print which file it can't find, I'm not certain what could be causing this.
I can call g++, gcc and mingw32-make from command line and they're in Path.
I've removed VC directories, MS SDK directories, and this doesn't fix the problem either.
This is a clean "install", I extracted tar.gz contents, and run configure without modifying anything. Adding mingw include path via -I switch to configure doesn't fix the problem.
How do I fix this?
Additional info:
g++ version: 4.7.1
mingw32-make version: 3.82.90
Figured it out. (Well, I still don't know what was causing this, but I know how to make it work).
Solution:
Place qt.conf into qt "bin" directory.
[Paths]
Prefix = d:/development/qt-4.8.5-mingw
Prefix is path of your qt installation (notice forward slashes).
Configure and compile using bat files:
To configure:
set QTDIR=D:\development\qt-4.8.5-mingw
set QMAKESPEC=win32-g++
set PATH=D:\development\MinGW\bin;D:\development\tools\Perl32\bin;D:\development\qt-4.8.5-mingw\bin
set PATH=%PATH%;c:\Windows\system32
set INCLUDE=
set LIB=
set CPATH=
set CPLUS_INCLUDE_PATH=
set LANG=en
configure -opensource -openssl
You should put into path bin directory of 32bit perl, bin directory of mingw32 installation, and bin directory of qt installation. -openssl key is optional (I need this one).
To compile:
set QTDIR=D:\development\qt-4.8.5-mingw
set QMAKESPEC=win32-g++
set PATH=D:\development\MinGW\bin;D:\development\tools\Perl32\bin;D:\development\qt-4.8.5-mingw\bin
set PATH=%PATH%;c:\Windows\system32
set INCLUDE=
set LIB=
set CPATH=
set CPLUS_INCLUDE_PATH=
set LANG=en
mingw32-make

Audiere incomplete universal character name \U Error

Hey so I'm trying to make a music player using QT and Audiere. First I installed Audiere and put the header file in the compiler's include folder. Then I added the .lib file to the QT project. I wrote the following code:
AudioDevicePtr device(OpenDevice());
if(!device){
//failure
}
SampleSource* source = OpenSampleSource("C:\Users\Amenechi\Downloads\LMFAO - Sexy And I Know It");
OutputStreamPtr stream(OpenSound(device,source,true));
if(!stream){
//failure
}
stream->setRepeat(true);
stream->setVolume(0.5f);
stream->play();
But I get this error:
http://s20.postimage.org/u1yxk0d0s/Untitled.jpg
Now I'm not sure where it went wrong, maybe i installed the audiere library incorrectly?
EDIT:
Hey here's the compile output if that helps.
07:37:45: Running steps for project QTunesV2...
07:37:45: Configuration unchanged, skipping qmake step.
07:37:45: Starting: "C:\Qt\Qt5.0.1\Tools\MinGW\bin\mingw32-make.exe"
C:/Qt/Qt5.0.1/Tools/MinGW/bin/mingw32-make -f Makefile.Debug
mingw32-make[1]: Entering directory 'C:/Qt/Qt5.0.1/Tools/QtCreator/bin/QTunesV1/QTunesV2-build-Desktop_Qt_5_0_1_MinGW_32bit-Debug'
g++ -Wl,-subsystem,windows -mthreads -o debug\QTunesV2.exe debug/main.o debug/mainwindow.o debug/moc_mainwindow.o -lmingw32 -lqtmaind -LC:/Qt/Qt5.0.1/Tools/QtCreator/bin/QTunesV1/QTunesV2/../../ -laudiered -LC:\Qt\Qt5.0.1\5.0.1\mingw47_32\lib -lQt5Widgetsd -lQt5Guid -lQt5Cored -llibEGLd -llibGLESv2d -lgdi32 -luser32
c:/qt/qt5.0.1/tools/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -laudiered
collect2.exe: error: ld returned 1 exit status
Makefile.Debug:80: recipe for target 'debug\QTunesV2.exe' failed
mingw32-make[1]: *** [debug\QTunesV2.exe] Error 1
mingw32-make[1]: Leaving directory 'C:/Qt/Qt5.0.1/Tools/QtCreator/bin/QTunesV1/QTunesV2-build-Desktop_Qt_5_0_1_MinGW_32bit-Debug'
mingw32-make: *** [debug] Error 2
makefile:34: recipe for target 'debug' failed
07:37:45: The process "C:\Qt\Qt5.0.1\Tools\MinGW\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project QTunesV2 (kit: Desktop Qt 5.0.1 MinGW 32bit)
When executing step 'Make'

GLFW and Netbeans acting up

I have some problems linking to GLFW in Netbeans, I have followed the instructions here:
http://forums.netbeans.org/topic51143.html
I have installed Cygwin and MinGW on my computer, I had since earlier an installation of Cygwin, which I tried to use to compile a GLFW program, but I got the same error, so I decided to try MinGW, as per the instructions, still the same problem.
Also, for some reason I can't use msys make.exe as make command, even for compiling a C++ hello world, I have to use the one in Cygwin instead. I have set up windows Path variable to include the locations of both the msys bin directories.
"1) What must be installed (dlls, etc)?
glfw.dll
libgcc_s_dw2-1.dll
libstdc++-6.dll"
I am not sure what this means, does installed in this instance mean that System32/SysWOW64 should contain those mentioned .dlls?
My output for this program (using linker properties as specified here :
http://forums.netbeans.org/topic51143.html)
#include <cstdlib>
#include <stdio.h>
#include <GL/glfw.h>
using namespace std;
int main(int argc, char** argv) {
if (!glfwInit())
return -1;
return 0;
}
Yields:
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory /cygdrive/c/Users/sysdba/Documents/NetBeansProjects/GLFW'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW_QT-Windows/glfw.exe
make[2]: Entering directory/cygdrive/c/Users/sysdba/Documents/NetBeansProjects/GLFW'
mkdir -p build/Debug/MinGW_QT-Windows
rm -f build/Debug/MinGW_QT-Windows/main.o.d
g++.exe -lglfwdll -DGLFW_DLL -c -g -Wall -I../../../Downloads/glfw-2.7.7.bin.WIN64/glfw-2.7.7.bin.WIN64/lib-mingw -MMD -MP -MF build/Debug/MinGW_QT-Windows/main.o.d -o build/Debug/MinGW_QT-Windows/main.o main.cpp
g++: -lglfwdll: linker input file unused because linking not done
mkdir -p dist/Debug/MinGW_QT-Windows
g++.exe -lglfwdll -DGLFW_DLL -o dist/Debug/MinGW_QT-Windows/glfw build/Debug/MinGW_QT-Windows/main.o -L../../../../../MinGW/lib -lglfw -lglu32 -lopengl32 -lglfwdll
nbproject/Makefile-Debug.mk:62: recipe for target dist/Debug/MinGW_QT-Windows/glfw.exe' failed
make[2]: Leaving directory/cygdrive/c/Users/sysdba/Documents/NetBeansProjects/GLFW'
nbproject/Makefile-Debug.mk:59: recipe for target .build-conf' failed
make[1]: Leaving directory/cygdrive/c/Users/sysdba/Documents/NetBeansProjects/GLFW'
nbproject/Makefile-impl.mk:39: recipe for target .build-impl' failed
build/Debug/MinGW_QT-Windows/main.o: In functionmain':
/cygdrive/c/Users/sysdba/Documents/NetBeansProjects/GLFW/main.cpp:20: undefined reference to `_imp_glfwInit#0'
collect2: ld returned 1 exit status
make[2]: * [dist/Debug/MinGW_QT-Windows/glfw.exe] Error 1
Any idea of what the problem could be? Could it be related to the fact that I am not using the msys make.exe as make command?
I fixed my MinGW install, so I could use the make.exe in the MinGW msys, instead of the cygwin mysys, did not help.
Not much of an answer, but it seems to be a problem with GLFW somewhere, could not get it to work. I switched to freeglut, Worked like a charm, without any hassle.