Question

I know I can run qmake from the command line and use:

-spec linux-g++-32 

From the .pro file i've tried to add alternatively "-m32" or "-32" to "CFLAGS" or "QMAKE_CXXFLAGS" but it does not work.

CFLAGS += -m32
QMAKE_CXXFLAGS += -m32

What shall I do then ?

EDIT:

this is what is produced with the above flag...

g++ -c -pipe -m32 -g -Wall -W -D_REENTRANT -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_SHARED -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++ -I../fxa_march -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I. -I../fxa_march -I. -o fxa_march.o ../fxa_march/fxa_march.cpp
g++ -c -pipe -m32 -g -Wall -W -D_REENTRANT -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_SHARED -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++ -I../fxa_march -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I. -I../fxa_march -I. -o reports.o ../fxa_march/reports.cpp
g++ -c -pipe -m32 -g -Wall -W -D_REENTRANT -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_SHARED -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++ -I../fxa_march -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I. -I../fxa_march -I. -o fxa_march_params.o ../fxa_march/fxa_march_params.cpp
g++ -c -pipe -m32 -g -Wall -W -D_REENTRANT -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_SHARED -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++ -I../fxa_march -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I. -I../fxa_march -I. -o reportgroup.o ../fxa_march/reportgroup.cpp
g++ -c -pipe -m32 -g -Wall -W -D_REENTRANT -DQT_XMLPATTERNS_LIB -DQT_XML_LIB -DQT_CORE_LIB -DQT_SHARED -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++ -I../fxa_march -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I. -I../fxa_march -I. -o db_wrapper.o ../fxa_march/db_wrapper.cpp
../fxa_march/db_wrapper.cpp: In function 'std::string as_string(FX::dbvalue, FX::dbtype)':
../fxa_march/db_wrapper.cpp:17: warning: enumeration value 'dbtype_dbvoid' not handled in switch
../fxa_march/db_wrapper.cpp:17: warning: enumeration value 'dbtype_dbdate' not handled in switch
../fxa_march/db_wrapper.cpp:17: warning: enumeration value 'dbtype_dbmoney' not handled in switch
g++ -Wl,-rpath,/Soft/fox_dev/Qt-4.7.4/lib -o fxa_march fxa_march.o reports.o fxa_march_params.o reportgroup.o db_wrapper.o    -L/Soft/fox_dev/Qt-4.7.4/lib -L../../../fx/libfx -lfx -L../../../fx/MQLib -lMQ -L/Soft/fox_dev/boost/boost_bin/lib -lboost_timer -lboost_system -lboost_chrono -lboost_regex -L/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/lib -lxerces-c -lQtXmlPatterns -L/Soft/fox_dev/Qt-4.7.4/lib -lQtNetwork -lQtXml -lQtCore -lpthread
/usr/bin/ld: skipping incompatible ../../../fx/libfx/libfx.so when searching for -lfx
/usr/bin/ld: cannot find -lfx
collect2: ld returned 1 exit status
make: *** [fxa_march] Error 1
Was it helpful?

Solution

Ok, here is the point:

the diff between the generated makefile ( through QtCreator ) and the one generated by my command line is:

INCPATH       = -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++-32 -I. -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I.

Vs

INCPATH       = -I/Soft/fox_dev/Qt-4.7.4/mkspecs/linux-g++ -I../fxa_march -I/Soft/fox_dev/Qt-4.7.4/include/QtCore -I/Soft/fox_dev/Qt-4.7.4/include/QtXml -I/Soft/fox_dev/Qt-4.7.4/include/QtXmlPatterns -I/Soft/fox_dev/Qt-4.7.4/include -I../../../fx/libfx -I../../../fx/MQLib -I/Soft/fox_dev/boost/boost_1_54_0 -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I/Soft/fox_dev/xerces-c-3.1.1-x86-linux-gcc-3.4/include -I. -I../fxa_march -I.

however one can go to "Project-> Build Settings -> [choose configuration to modify] -> And edit the "Qmake step" with additionnal argument:

-spec linux-g++-32 

you will also need to add in the .pro file either of:

CFLAGS += -m32
QMAKE_CXXFLAGS += -m32

OTHER TIPS

In .pro file, try writting all commands inside a scope prefixed by win32

win32 {
     SOURCES += paintwidget_win.cpp
     # ...
 }

Commands inside the scope will be run only if the win32 variable is set.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top