ld: symbol(s) not found for architecture x86_64 qt - c++

I'm trying to compile a basic Qt program:
#include <iostream>
#include <QApplication>
int main(int argc, char** argv) {
QApplication app(argc, argv);
std::cout << "test" << std::endl;
}
To start a Qt-project I did the following:
Make a project.pro file:
TEMPLATE += app
QT += widgets gui
SOURCES += main.cpp
Run the qmake command.
Edit the following in the generated Makefile:
-mmacosx-version-min=10.15.3 in CXXFLAGS
remove the -c argument from the compiler
Than I ran make and got the following error output:
/Library/Developer/CommandLineTools/usr/bin/clang++ -pipe -stdlib=libc++ -O2 -std=gnu++11 -arch x86_64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=10.15.3 -Wall -Wextra -fPIC -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I. -I/usr/local/Cellar/qt/5.14.1/lib/QtWidgets.framework/Headers -I/usr/local/Cellar/qt/5.14.1/lib/QtGui.framework/Headers -I/usr/local/Cellar/qt/5.14.1/lib/QtCore.framework/Headers -I. -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AGL.framework/Headers -I/usr/local/Cellar/qt/5.14.1/mkspecs/macx-clang -F/usr/local/Cellar/qt/5.14.1/lib -o main.o main.cpp
Undefined symbols for architecture x86_64:
"QApplication::QApplication(int&, char**, int)", referenced from:
_main in main-96fd09.o
"QApplication::~QApplication()", referenced from:
_main in main-96fd09.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [main.o] Error 1
I might have an idea what is causing this, when running make -v I get this output:
This program built for i386-apple-darwin11.3.0
clang++ --version generates this output:
Apple clang version 11.0.0 (clang-1100.0.33.16)
Target: x86_64-apple-darwin19.3.0
Thread model: posix
I think the Makefile is trying to compile my code for an older architecture and that's generating a conflict but I'm not sure. My system is a Macbook Pro running MacOS Catalina 10.15.3. Qt is version 15.4.1. Qmake is version 3.1.
Full Makefile:
#############################################################################
# Makefile for building: test.app/Contents/MacOS/test
# Generated by qmake (3.1) (Qt 5.14.1)
# Project: test.pro
# Template: app
# Command: /usr/local/Cellar/qt/5.14.1/bin/qmake -o Makefile test.pro
#############################################################################
MAKEFILE = Makefile
EQ = =
####### Compiler, tools and options
CC = /Library/Developer/CommandLineTools/usr/bin/clang
CXX = /Library/Developer/CommandLineTools/usr/bin/clang++
DEFINES = -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
CFLAGS = -pipe -O2 $(EXPORT_ARCH_ARGS) -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=10.13 -Wall -Wextra -fPIC $(DEFINES)
CXXFLAGS = -pipe -stdlib=libc++ -O2 -std=gnu++11 $(EXPORT_ARCH_ARGS) -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=10.15.3 -Wall -Wextra -fPIC $(DEFINES)
INCPATH = -I. -I/usr/local/Cellar/qt/5.14.1/lib/QtWidgets.framework/Headers -I/usr/local/Cellar/qt/5.14.1/lib/QtGui.framework/Headers -I/usr/local/Cellar/qt/5.14.1/lib/QtCore.framework/Headers -I. -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AGL.framework/Headers -I/usr/local/Cellar/qt/5.14.1/mkspecs/macx-clang -F/usr/local/Cellar/qt/5.14.1/lib
QMAKE = /usr/local/Cellar/qt/5.14.1/bin/qmake
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_FILE = cp -f
COPY_DIR = cp -f -R
INSTALL_FILE = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR = cp -f -R
QINSTALL = /usr/local/Cellar/qt/5.14.1/bin/qmake -install qinstall
QINSTALL_PROGRAM = /usr/local/Cellar/qt/5.14.1/bin/qmake -install qinstall -exe
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
TAR = tar -cf
COMPRESS = gzip -9f
DISTNAME = test1.0.0
DISTDIR = /Users/myName/School/C++/QtTest/.tmp/test1.0.0
LINK = /Library/Developer/CommandLineTools/usr/bin/clang++
LFLAGS = -stdlib=libc++ -headerpad_max_install_names $(EXPORT_ARCH_ARGS) -Wl,-syslibroot,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=10.13 -Wl,-rpath,#executable_path/../Frameworks
LIBS = $(SUBLIBS) -F/usr/local/Cellar/qt/5.14.1/lib -framework QtWidgets -framework QtGui -framework AppKit -framework Metal -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL
AR = /Library/Developer/CommandLineTools/usr/bin/ar cq
RANLIB = /Library/Developer/CommandLineTools/usr/bin/ranlib -s
SED = sed
STRIP = strip
####### Output directory
OBJECTS_DIR = ./
####### Files
SOURCES = main.cpp
OBJECTS = main.o
DIST = /usr/local/Cellar/qt/5.14.1/mkspecs/features/spec_pre.prf \
/usr/local/Cellar/qt/5.14.1/mkspecs/qdevice.pri \
/usr/local/Cellar/qt/5.14.1/mkspecs/features/device_config.prf \
/usr/local/Cellar/qt/5.14.1/mkspecs/common/unix.conf \
/usr/local/Cellar/qt/5.14.1/mkspecs/common/mac.conf \
/usr/local/Cellar/qt/5.14.1/mkspecs/features/mac/rez.prf \
/usr/local/Cellar/qt/5.14.1/mkspecs/features/mac/asset_catalogs.prf \
/usr/local/Cellar/qt/5.14.1/mkspecs/features/testcase_targets.prf \
/usr/local/Cellar/qt/5.14.1/mkspecs/features/exceptions.prf \
/usr/local/Cellar/qt/5.14.1/mkspecs/features/yacc.prf \
/usr/local/Cellar/qt/5.14.1/mkspecs/features/lex.prf \
MORE FILES HERE
test.pro main.cpp
QMAKE_TARGET = test
DESTDIR =
TARGET = test.app/Contents/MacOS/test
####### Custom Variables
EXPORT_QMAKE_MAC_SDK = macosx
EXPORT_QMAKE_MAC_SDK_VERSION = 10.15.1
EXPORT_QMAKE_XCODE_DEVELOPER_PATH = /Library/Developer/CommandLineTools
EXPORT_VALID_ARCHS = x86_64
EXPORT_ACTIVE_ARCHS = $(filter $(EXPORT_VALID_ARCHS), $(ARCHS))
EXPORT_ARCH_ARGS = $(foreach arch, $(if $(EXPORT_ACTIVE_ARCHS), $(EXPORT_ACTIVE_ARCHS), $(EXPORT_VALID_ARCHS)), -arch $(arch))
EXPORT__PRO_FILE_ = /Users/myName/School/C++/QtTest/test.pro
include /usr/local/Cellar/qt/5.14.1/mkspecs/features/mac/sdk.mk
first: all
####### Build rules
test.app/Contents/MacOS/test: $(OBJECTS)
#test -d test.app/Contents/MacOS/ || mkdir -p test.app/Contents/MacOS/
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
Makefile: test.pro /usr/local/Cellar/qt/5.14.1/mkspecs/macx-clang/qmake.conf /usr/local/Cellar/qt/5.14.1/mkspecs/features/spec_pre.prf \
/usr/local/Cellar/qt/5.14.1/mkspecs/qdevice.pri \
/usr/local/Cellar/qt/5.14.1/mkspecs/features/device_config.prf \
/usr/local/Cellar/qt/5.14.1/mkspecs/common/unix.conf \
/usr/local/Cellar/qt/5.14.1/mkspecs/features/exceptions.prf \
/usr/local/Cellar/qt/5.14.1/mkspecs/features/yacc.prf \
/usr/local/Cellar/qt/5.14.1/mkspecs/features/lex.prf \
test.pro \
/usr/local/Cellar/qt/5.14.1/lib/QtWidgets.framework/Resources/QtWidgets.prl \
/usr/local/Cellar/qt/5.14.1/lib/QtGui.framework/Resources/QtGui.prl \
/usr/local/Cellar/qt/5.14.1/lib/QtCore.framework/Resources/QtCore.prl
MORE FILES HERE
$(QMAKE) -o Makefile test.pro
/usr/local/Cellar/qt/5.14.1/mkspecs/features/spec_pre.prf:
/usr/local/Cellar/qt/5.14.1/mkspecs/qdevice.pri:
/usr/local/Cellar/qt/5.14.1/mkspecs/features/device_config.prf:
/usr/local/Cellar/qt/5.14.1/mkspecs/common/unix.conf:
/usr/local/Cellar/qt/5.14.1/mkspecs/common/mac.conf:
/usr/local/Cellar/qt/5.14.1/mkspecs/features/lex.prf:
test.pro:
/usr/local/Cellar/qt/5.14.1/lib/QtWidgets.framework/Resources/QtWidgets.prl:
/usr/local/Cellar/qt/5.14.1/lib/QtGui.framework/Resources/QtGui.prl:
/usr/local/Cellar/qt/5.14.1/lib/QtCore.framework/Resources/QtCore.prl:
MORE FILES HERE
qmake: FORCE
#$(QMAKE) -o Makefile test.pro
qmake_all: FORCE
test.app/Contents/PkgInfo:
#test -d test.app/Contents || mkdir -p test.app/Contents
#$(DEL_FILE) test.app/Contents/PkgInfo
#echo "APPL????" > test.app/Contents/PkgInfo
test.app/Contents/Resources/empty.lproj:
#test -d test.app/Contents/Resources || mkdir -p test.app/Contents/Resources
#touch test.app/Contents/Resources/empty.lproj
test.app/Contents/Info.plist:
#test -d test.app/Contents || mkdir -p test.app/Contents
#$(DEL_FILE) test.app/Contents/Info.plist
#sed -e "s,#SHORT_VERSION#,1.0,g" -e "s,\$${QMAKE_SHORT_VERSION},1.0,g" -e "s,#FULL_VERSION#,1.0.0,g" -e "s,\$${QMAKE_FULL_VERSION},1.0.0,g" -e "s,#TYPEINFO#,????,g" -e "s,\$${QMAKE_PKGINFO_TYPEINFO},????,g" -e "s,#BUNDLEIDENTIFIER#,com.yourcompany.test,g" -e "s,\$${PRODUCT_BUNDLE_IDENTIFIER},com.yourcompany.test,g" -e "s,\$${MACOSX_DEPLOYMENT_TARGET},10.13,g" -e "s,\$${IPHONEOS_DEPLOYMENT_TARGET},,g" -e "s,\$${TVOS_DEPLOYMENT_TARGET},,g" -e "s,\$${WATCHOS_DEPLOYMENT_TARGET},,g" -e "s,#ICON#,,g" -e "s,\$${ASSETCATALOG_COMPILER_APPICON_NAME},,g" -e "s,#EXECUTABLE#,test,g" -e "s,#LIBRARY#,test,g" -e "s,\$${EXECUTABLE_NAME},test,g" -e "s,#TYPEINFO#,????,g" -e "s,\$${QMAKE_PKGINFO_TYPEINFO},????,g" /usr/local/Cellar/qt/5.14.1/mkspecs/macx-clang/Info.plist.app >test.app/Contents/Info.plist
all: Makefile \
test.app/Contents/PkgInfo \
test.app/Contents/Resources/empty.lproj \
test.app/Contents/Info.plist test.app/Contents/MacOS/test
dist: distdir FORCE
(cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar) && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR)
distdir: FORCE
#test -d $(DISTDIR) || mkdir -p $(DISTDIR)
$(COPY_FILE) --parents $(DIST) $(DISTDIR)/
$(COPY_FILE) --parents /usr/local/Cellar/qt/5.14.1/mkspecs/features/data/dummy.cpp $(DISTDIR)/
$(COPY_FILE) --parents main.cpp $(DISTDIR)/
clean: compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
distclean: clean
-$(DEL_FILE) -r test.app
-$(DEL_FILE) .qmake.stash
-$(DEL_FILE) Makefile
####### Sub-libraries
xcodeproj:
#$(QMAKE) -spec macx-xcode "$(EXPORT__PRO_FILE_)"
mocclean: compiler_moc_header_clean compiler_moc_objc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_objc_header_make_all compiler_moc_source_make_all
check: first
benchmark: first
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_moc_predefs_make_all: moc_predefs.h
compiler_moc_predefs_clean:
-$(DEL_FILE) moc_predefs.h
moc_predefs.h: /usr/local/Cellar/qt/5.14.1/mkspecs/features/data/dummy.cpp
/Library/Developer/CommandLineTools/usr/bin/clang++ -pipe -stdlib=libc++ -O2 -std=gnu++11 $(EXPORT_ARCH_ARGS) -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -mmacosx-version-min=10.13 -Wall -Wextra -dM -E -o moc_predefs.h /usr/local/Cellar/qt/5.14.1/mkspecs/features/data/dummy.cpp
compiler_moc_header_make_all:
compiler_moc_header_clean:
compiler_moc_objc_header_make_all:
compiler_moc_objc_header_clean:
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all:
compiler_uic_clean:
compiler_rez_source_make_all:
compiler_rez_source_clean:
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean: compiler_moc_predefs_clean
####### Compile
main.o: main.cpp /usr/local/Cellar/qt/5.14.1/lib/QtWidgets.framework/Headers/QApplication \
/usr/local/Cellar/qt/5.14.1/lib/QtWidgets.framework/Headers/qapplication.h
$(CXX) $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:
Thanks!

I made a very basic mistake. Everything was working, but the Makefile outputted a main.o file. I tried to execute my application by using ./main.o. This is not possible.
The correct way to execute a Qt application is by using open main.app.
No need to alter the makefile.
Create a myApp.pro file
Example:
TEMPLATE += app
QT += widgets gui
SOURCES += myApp.cpp
Execute qmake
Execute make
Execute open myApp.app

Related

make: *** No rule to make target `my_project.o', needed by `objects'. Stop

This is my makefile in linux
.SILENT:
.SUFFIXES: .cpp
FLAGS_CC = -c -fPIC -DUNIX -DLINUX -D_HNAREL_=500 -D_TARGET__REL=0 -D_TARGET__DEBUG=1 -D_ILS_MACROS -I$(cer_incl)
FLAGS_CPP = -c -Wno-deprecated -fPIC -frtti -finline-functions -DUNIX -DLINUX -D_HNAREL_=500 -D_TARGET__REL=0 -D_TARGET__DEBUG=1 -D_ILS_MACROS -I$(cer_incl)
FLAGS_LINK = -m32 -fPIC -lm -lc -lrt -lpthread -ldl
FLAGS_LINKSHR = -m32 -lm -lc -shared -Wl,-no-undefined -lrt -lpthread -ldl
CC = gcc $(FLAGS_CC) $(__define) $(__build)
CPP = g++ $(FLAGS_CPP) $(__define) $(__build)
LINK = g++ $(FLAGS_LINK)
LINKSHR = g++ $(FLAGS_LINKSHR)
PRINT = echo
##
## The following environment variables are defined for your convenience.
##-----
## __srcdir - Project directory that contains the makefile and source code.
## __objdir - Project subdirectory that stores objects for the given platform
## and target combination.
## __libdir - Public directory that contains objects and shareable libraries.
## __exedir - Public directory that contains executables.
##-----
## Please do not delete the following line!
###makefile###
###makedep###
#my_project.o
FLAGS__MY_PROJECT =
DEFINES__MY_PROJECT =
my_project.o: $(__objdir)/my_project.o
$(__objdir)/my_project.o: \
my_project.cpp \
$(cer_incl)/srvimpl.h \
$(PRINT) "compiling - my_project.cpp"
[[ -d $(__objdir) ]] || mkdir -p $(__objdir)
$(CPP) $(FLAGS__MY_PROJECT) $(DEFINES__MY_PROJECT) -o $(__objdir)/my_project.o my_project.cpp
#aps_s200061.o
FLAGS__APS_S200061 =
DEFINES__APS_S200061 =
aps_s200061.o: $(__objdir)/aps_s200061.o
$(__objdir)/aps_s200061.o: \
aps_s200061.cpp \
aps_s200061.h \
$(cer_incl)/srvimpl.h \
$(PRINT) "compiling - aps_s200061.cpp"
[[ -d $(__objdir) ]] || mkdir -p $(__objdir)
$(CPP) $(FLAGS__APS_S200061) $(DEFINES__APS_S200061) -o $(__objdir)/aps_s200061.o aps_s200061.cpp
###makedep###
FLAGS_CPP += -D__RHEL6
FLAGS__APS_S200061 =
objects: my_project.o aps_s200061.o
my_project : objects
$(PRINT) "creating - my_project "
$(LINKSHR) \
-Wl,--version-script=$(__srcdir)/my_project.emap \
-o $(__objdir)/my_project \
$(__objdir)/my_project.o \
$(__objdir)/aps_s200061.o \
-Wl,--start-group \
-L$(__libdir) -lapsobj -lcernobj -lcontainerobj -lstringobj -li18n_common -lmsgutilobj -lmftmiscobj -lsrvcoreobj -lcrmobj -lthreadobj \
-Wl,--whole-archive -lsrvobj -Wl,--no-whole-archive \
-Wl,--end-group \
-L$(__exedir) -ldb -ldps -lsrv -lsec \
-lcclora -lreg -lmsgapi -ldate \
-llogical -lsrvcore -lcrm
copy:
$(PRINT) "copying - my_project"
cp $(__objdir)/my_project $(__exedir)
it: my_project copy
# shr:my_project
I want to remove the command cp $(__objdir)/my_project $(__exedir) from the above file.
When I try removing the line manually in a text editor and save it , the make file doesn't throw any errors.
But if I try removing the line programmatically , we get make: *** No rule to make target my_project.o', needed by objects'. Stop.
Sequence of commands we use is :
'makedep'
'make -f ${PWD##*/}.linux -r __target=rel _define="-D_TARGET=_TARGET__REL " __srcdir=$PWD __objdir=$PWD/linuxx86-64 __libdir=$abc_lib_rel __exedir=$abc_exe_rel __build="-O3" it'

linking include path problem in qt project makfile

I am trying to build my c++ project using this make file :
CXX=g++ -std=c++11
LD=g++
DEFINES = -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NO_VERSION_TAGGING
CFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
CXXFLAGS = -m64 -pipe -O2 -std=gnu++0x -Wall -W -D_REENTRANT -fPIC $(DEFINES)
INCPATH = -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64
QMAKE = /usr/lib/x86_64-linux-gnu/qt5/bin/qmake
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_FILE = cp -f
COPY_DIR = cp -f -R
INSTALL_FILE = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR = cp -f -R
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
TAR = tar -cf
COMPRESS = gzip -9f
LINK = g++
LFLAGS = -m64 -Wl,-O1
LIBS = $(SUBLIBS) -L/usr/X11R6/lib64 -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
AR = ar cqs
RANLIB =
SED = sed
STRIP = strip
LIBS= $(SUBLIBS) -L/usr/X11R6/lib64 -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
INCPATH= -I. -I. -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtWidgets -isystem /usr/include/x86_64-linux-gnu/qt5/QtGui -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -I. -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64
LDFLAGS=-Wall -fPIC -Wextra -O3 -fopenmp -L/usr/X11R6/lib -lX11 -lSDL -lrt -lpthread -lXft -L/usr/local/lib/mysql -lmysqlclient -lXpm -L./ -lMyTestLicense
FREETYPE_CFLAGS=$(shell freetype-config --cflags )
FREETYPE_LDFLAGS=$(shell freetype-config --libs)
####### Output directory
OBJECTS_DIR = ./
####### Files
SOURCES=$(wildcard *.cpp)
OBJECTS=$(SOURCES:.cpp=.o)
EXECUTABLE=test
QMAKE_TARGET = test
DESTDIR =
TARGET = test
####### Build rules
$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
all:$(EXECUTABLE)
$(EXECUTABLE): $(OBJECTS)
$(LD) $(FREETYPE_LDFLAGS) $(OBJECTS) $(LDFLAGS) -o $#
####### Compile
.cpp.o:
$(CXX) $(FREETYPE_CFLAGS) $(CXXFLAGS) $(INCPATH) -c -Wno-write-strings -g -fpermissive $< -o $#
clean:
rm -rf *o test
i did not try to create make file using qmake because of special library that i need in my own project, So i decided to write my own makefile, and this is the only class(testmain.cpp) in my source code that i use QT library in it,thi is testmain.cpp:
#include <QtWidgets>
int main(int argc, char **argv)
{
QApplication app(argc, argv);
QWidget qWin;
QGridLayout qGrid;
qGrid.addWidget(new QLabel("UTF-8:"), 1, 0);
QByteArray string = "شهاب حسینی";
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
QString encodedString = codec->toUnicode(string);
qGrid.addWidget(new QLabel(encodedString), 1, 1);
qWin.setLayout(&qGrid);
qWin.show();
return app.exec();
}
but when I try to make my project ,executable test will not produce and i face with this errors which part of my make file is wrong ?
> In function `QTypedArrayData<char>::deallocate(QArrayData*)':
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qarraydata.h:222: undefined
> reference to `QArrayData::deallocate(QArrayData*, unsigned long,
> unsigned long)' testmain.o: In function `QTypedArrayData<unsigned
> short>::deallocate(QArrayData*)':
> /usr/include/x86_64-linux-gnu/qt5/QtCore/qarraydata.h:222: undefined
> reference to `QArrayData::deallocate(QArrayData*, unsigned long,
> unsigned long)'

How to solve Exec format error not related to architecture incompatibilities?

I am trying to use Qt to make my cpp codes nicer to use. So I exploited the qmake -project to subsequently generate a Makefile. Nevertheless even with the simplest example, when executing the main.o file obtaining by typing make, I am getting bash: ./main.o: cannot execute binary file: Exec format error.
So I looked on the internet, and this problem is often related to architecture incompatibilities. That's why I exploited file main.o and uname -a commands in terminal. To my surprise, they respectively returned:
main.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
Linux mario-Inspiron-7577 4.15.0-64-generic #73-Ubuntu SMP Thu Sep 12 13:16:13 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
Which to me doesn't seem to be conflicting. Am I missing out on something huge? What could I do to make it run smoothly?
If it can be of any help as suggested by #NathanOliver, here is my Makefile, generated with qmake:
#############################################################################
# Makefile for building: QTexample
# Generated by qmake (3.1) (Qt 5.9.5)
# Project: QTexample.pro
# Template: app
# Command: /home/mario/anaconda3/bin/qmake -o Makefile QTexample.pro
#############################################################################
MAKEFILE = Makefile
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB
CFLAGS = -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
CXXFLAGS = -pipe -O2 -Wall -W -D_REENTRANT -fPIC $(DEFINES)
INCPATH = -I. -I. -I../../anaconda3/include/qt -I../../anaconda3/include/qt/QtWidgets -I../../anaconda3/include/qt/QtGui -I../../anaconda3/include/qt/QtCore -I. -I../../anaconda3/mkspecs/linux-g++
QMAKE = /home/mario/anaconda3/bin/qmake
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_FILE = cp -f
COPY_DIR = cp -f -R
INSTALL_FILE = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR = cp -f -R
QINSTALL = /home/mario/anaconda3/bin/qmake -install qinstall
QINSTALL_PROGRAM = /home/mario/anaconda3/bin/qmake -install qinstall -exe
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
TAR = tar -cf
COMPRESS = gzip -9f
DISTNAME = QTexample1.0.0
DISTDIR = /home/mario/Tools/QTexample/.tmp/QTexample1.0.0
LINK = g++
LFLAGS = -Wl,-O1 -Wl,-rpath,/home/mario/anaconda3/lib
LIBS = $(SUBLIBS) -L/home/mario/anaconda3/lib -lQt5Widgets -lQt5Gui -lQt5Core -lGL -lpthread
AR = ar cqs
RANLIB =
SED = sed
STRIP = strip
####### Output directory
OBJECTS_DIR = ./
####### Files
SOURCES = main.cpp
OBJECTS = main.o
DIST = ../../anaconda3/mkspecs/features/spec_pre.prf \
../[...]
QTexample.pro main.cpp
QMAKE_TARGET = QTexample
DESTDIR =
TARGET = QTexample
first: all
####### Build rules
$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
Makefile: QTexample.pro ../../anaconda3/mkspecs/linux-g++/qmake.conf ../../anaconda3/mkspecs/features/spec_pre.prf \[...]
qmake: FORCE
#$(QMAKE) -o Makefile QTexample.pro
qmake_all: FORCE
all: Makefile $(TARGET)
dist: distdir FORCE
(cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar) && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR)
distdir: FORCE
#test -d $(DISTDIR) || mkdir -p $(DISTDIR)
$(COPY_FILE) --parents $(DIST) $(DISTDIR)/
$(COPY_FILE) --parents ../../anaconda3/mkspecs/features/data/dummy.cpp $(DISTDIR)/
$(COPY_FILE) --parents main.cpp $(DISTDIR)/
clean: compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
distclean: clean
-$(DEL_FILE) $(TARGET)
-$(DEL_FILE) .qmake.stash
-$(DEL_FILE) Makefile
####### Sub-libraries
mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
check: first
benchmark: first
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_moc_predefs_make_all: moc_predefs.h
compiler_moc_predefs_clean:
-$(DEL_FILE) moc_predefs.h
moc_predefs.h: ../../anaconda3/mkspecs/features/data/dummy.cpp
g++ -pipe -O2 -Wall -W -dM -E -o moc_predefs.h ../../anaconda3/mkspecs/features/data/dummy.cpp
compiler_moc_header_make_all:
compiler_moc_header_clean:
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all:
compiler_uic_clean:
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean: compiler_moc_predefs_clean
####### Compile
main.o: main.cpp ../../anaconda3/include/qt/QtWidgets/qapplication.h \[...]
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o main.o main.cpp
#####
main: $(OBJS) $(CXX) $(LDFLAGS) -o main $(OBJS) $(LDLIBS)
####### Install
install: FORCE
uninstall: FORCE
FORCE:

Trying to cross-compile qt4/qt5 applications from Linux Ubuntu 32bit to Windows (32bit)

I tried to cross-compile the following code:
//test.cpp
#include <QApplication>
#include <QWidget>
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
QWidget window;
window.resize(250, 150);
window.setWindowTitle("Test");
window.show();
return app.exec();
}
following those instructions: Building Qt 5 on Linux, for Windows. I downloaded and built the source, created a Makefile and tried to build my project. after getting lot of undefined reference errors, I changed the includes to
#include "/home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/include/QtWidgets/QApplication"
#include "/home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/include/QtWidgets/QWidget"
and changed some paths in the Makefiles. But I am still getting lots of errors:
make
make -f Makefile.Release
make[1] : on entre dans le répertoire « /home/administrator/louis/buildwin »
/home/administrator/mxe/usr/bin/i686-w64-mingw32.static-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. -I../../mxe/usr/i686-w64-mingw32.static/qt5/include -I../../mxe/usr/i686-w64-mingw32.static/qt5/include/QtGui -I../../mxe/usr/i686-w64-mingw32.static/qt5/include/QtCore -Irelease -I../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/win32-g++ -o release/test.o test.cpp
/home/administrator/mxe/usr/bin/i686-w64-mingw32.static-g++ -Wl,-s -Wl,-subsystem,windows -mthreads -o release/buildwin.exe release/test.o release/buildwin_plugin_import.o -lglu32 -lmingw32 -L/home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libqtmain.a -L/home/administrator/mxe/usr/i686-w64-mingw32.static/lib -L/home/administrator/mxe/usr/i686-w64-mingw32.static/lib -L/home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/plugins/platforms /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/plugins/platforms/libqwindows.a -lwinspool /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5PlatformSupport.a /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5DBus.a -ldbus-1 -liphlpapi -ldbghelp -lnetapi32 -L/home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats/libqico.a /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Gui.a -lcomdlg32 -loleaut32 -limm32 -lopengl32 -ljpeg -lharfbuzz -lcairo -lgobject-2.0 -lfontconfig -lusp10 -lmsimg32 -lgdi32 -lpixman-1 -lffi -lexpat -lfreetype -lbz2 -lharfbuzz_too -lglib-2.0 -lwinmm -lshlwapi -lpcre -lintl -liconv -lpng16 /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Core.a -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmpr -lz -lpcre16
release/test.o:test.cpp:(.text+0x52): undefined reference to `QApplication::QApplication(int&, char**, int)'
release/test.o:test.cpp:(.text+0x73): undefined reference to `QWidget::QWidget(QWidget*, QFlags<Qt::WindowType>)'
release/test.o:test.cpp:(.text+0x99): undefined reference to `QWidget::resize(QSize const&)'
release/test.o:test.cpp:(.text+0xc8): undefined reference to `QWidget::setWindowTitle(QString const&)'
release/test.o:test.cpp:(.text+0xee): undefined reference to `QWidget::show()'
release/test.o:test.cpp:(.text+0xf3): undefined reference to `QApplication::exec()'
release/test.o:test.cpp:(.text+0xfe): undefined reference to `QWidget::~QWidget()'
release/test.o:test.cpp:(.text+0x106): undefined reference to `QApplication::~QApplication()'
release/test.o:test.cpp:(.text+0x177): undefined reference to `QWidget::~QWidget()'
release/test.o:test.cpp:(.text+0x17f): undefined reference to `QApplication::~QApplication()'
collect2: error: ld returned 1 exit status
Makefile.Release:62 : la recette pour la cible « release/buildwin.exe » a échouée
make[1]: *** [release/buildwin.exe] Erreur 1
make[1] : on quitte le répertoire « /home/administrator/louis/buildwin »
Makefile:34 : la recette pour la cible « release » a échouée
make: *** [release] Erreur 2
Those are the Makefiles. I only modified a few paths
in Makefile:
# Makefile for building: buildwin
# Generated by qmake (3.0) (Qt 5.7.1)
# Project: buildwin.pro
# Template: app
# Command: /home/administrator/mxe/usr/bin/i686-w64-mingw32.static-qmake-qt5 -o Makefile buildwin.pro
MAKEFILE = Makefile
first: release
install: release-install
uninstall: release-uninstall
QMAKE = /home/administrator/mxe/usr/bin/i686-w64-mingw32.static-qmake-qt5
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_FILE = cp -f
COPY_DIR = cp -f -R
INSTALL_FILE = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR = cp -f -R
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
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: buildwin.pro ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/win32-g++/qmake.conf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/spec_pre.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/qdevice.pri \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/device_config.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/common/angle.conf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/qconfig.pri \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_concurrent.pri \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_concurrent_private.pri \
###I shortened here to fit the 30k limit...
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qwindows.pri \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_windowsprintersupport.pri \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/qt_functions.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/qt_config.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/qt_config.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/win32-g++/qmake.conf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/spec_post.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/exclusive_builds.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/toolchain.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/default_pre.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/default_pre.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/resolve_config.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/exclusive_builds_post.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/default_post.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/rtti.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/precompile_header.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/warn_on.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/qt.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/resources.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/moc.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/opengl.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/file_copies.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/windows.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/testcase_targets.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/exceptions.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/yacc.prf \
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/lex.prf \
buildwin.pro \
../../mxe/usr/i686-w64-mingw32.static/qt5/lib/qtmain.prl \
../../mxe/usr/i686-w64-mingw32.static/qt5/lib/Qt5Gui.prl \
../../mxe/usr/i686-w64-mingw32.static/qt5/lib/Qt5Core.prl \
../../mxe/usr/i686-w64-mingw32.static/qt5/plugins/platforms/qwindows.prl \
../../mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats/qico.prl
$(QMAKE) -o Makefile buildwin.pro
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/spec_pre.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/qdevice.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/device_config.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/common/angle.conf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/qconfig.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_concurrent.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_concurrent_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_core.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_core_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_dbus.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_dbus_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_gui.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_gui_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_network.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_network_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_opengl.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_opengl_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_openglextensions.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_platformsupport_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_printsupport.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_printsupport_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_sql.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_sql_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_testlib.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_testlib_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_widgets.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_widgets_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_xml.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_xml_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_zlib_private.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qgenericbearer.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qico.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qminimal.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qnativewifibearer.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqlite.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqlmysql.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqlodbc.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqlpsql.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqltds.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qtuiotouchplugin.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qwindows.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_windowsprintersupport.pri:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/qt_functions.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/qt_config.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/qt_config.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/win32-g++/qmake.conf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/spec_post.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/exclusive_builds.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/toolchain.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/default_pre.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/default_pre.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/resolve_config.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/exclusive_builds_post.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/default_post.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/rtti.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/precompile_header.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/warn_on.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/qt.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/resources.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/moc.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/opengl.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/file_copies.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/windows.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/testcase_targets.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/exceptions.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/yacc.prf:
../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/lex.prf:
buildwin.pro:
../../mxe/usr/i686-w64-mingw32.static/qt5/lib/qtmain.prl:
../../mxe/usr/i686-w64-mingw32.static/qt5/lib/Qt5Gui.prl:
../../mxe/usr/i686-w64-mingw32.static/qt5/lib/Qt5Core.prl:
../../mxe/usr/i686-w64-mingw32.static/qt5/plugins/platforms/qwindows.prl:
../../mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats/qico.prl:
qmake: FORCE
#$(QMAKE) -o Makefile buildwin.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
-$(DEL_FILE) /home/administrator/louis/buildwin/buildwin_plugin_import.cpp
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
benchmark: first
FORCE:
$(MAKEFILE).Release: Makefile
$(MAKEFILE).Debug: Makefile
in Makefile.Release:
# Makefile for building: buildwin
# Generated by qmake (3.0) (Qt 5.7.1)
# Project: buildwin.pro
# Template: app
MAKEFILE = Makefile.Release
## Compiler, tools and options
CC = /home/administrator/mxe/usr/bin/i686-w64-mingw32.static-gcc
CXX = /home/administrator/mxe/usr/bin/i686-w64-mingw32.static-g++
DEFINES = -DUNICODE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN
CFLAGS = -pipe -fno-keep-inline-dllexport -O2 -Wall -Wextra $(DEFINES)
CXXFLAGS = -pipe -fno-keep-inline-dllexport -O2 -std=gnu++11 -frtti -Wall -Wextra -fexceptions -mthreads $(DEFINES)
INCPATH = -I. -I. -I../../mxe/usr/i686-w64-mingw32.static/qt5/include -I../../mxe/usr/i686-w64-mingw32.static/qt5/include/QtGui -I../../mxe/usr/i686-w64-mingw32.static/qt5/include/QtCore -Irelease -I../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/win32-g++
LINKER = /home/administrator/mxe/usr/bin/i686-w64-mingw32.static-g++
LFLAGS = -Wl,-s -Wl,-subsystem,windows -mthreads
LIBS = -lglu32 -lmingw32 -L/home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libqtmain.a -L/home/administrator/mxe/usr/i686-w64-mingw32.static/lib -L/home/administrator/mxe/usr/i686-w64-mingw32.static/lib -L/home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/plugins/platforms /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/plugins/platforms/libqwindows.a -lwinspool /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5PlatformSupport.a /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5DBus.a -ldbus-1 -liphlpapi -ldbghelp -lnetapi32 -L/home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats/libqico.a /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Gui.a -lcomdlg32 -loleaut32 -limm32 -lopengl32 -ljpeg -lharfbuzz -lcairo -lgobject-2.0 -lfontconfig -lusp10 -lmsimg32 -lgdi32 -lpixman-1 -lffi -lexpat -lfreetype -lbz2 -lharfbuzz_too -lglib-2.0 -lwinmm -lshlwapi -lpcre -lintl -liconv -lpng16 /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Core.a -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32 -lmpr -lz -lpcre16
QMAKE = /home/administrator/mxe/usr/bin/i686-w64-mingw32.static-qmake-qt5
IDC = idc
IDL = midl
ZIP =
DEF_FILE =
RES_FILE =
COPY = cp -f
SED = sed
COPY_FILE = cp -f
COPY_DIR = cp -f -R
DEL_FILE = rm -f
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
INSTALL_FILE = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR = cp -f -R
### Output directory
OBJECTS_DIR = release/
### Files
SOURCES = test.cpp /home/administrator/louis/buildwin/buildwin_plugin_import.cpp
OBJECTS = release/test.o \
release/buildwin_plugin_import.o
DIST = test.cpp
QMAKE_TARGET = buildwin
DESTDIR = release/ #avoid trailing-slash linebreak
TARGET = buildwin.exe
DESTDIR_TARGET = release/buildwin.exe
## Build rules
first: all
all: Makefile.Release $(DESTDIR_TARGET)
$(DESTDIR_TARGET): /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Gui.a /home/administrator/mxe/usr/i686-w64-mingw32.static/qt5/lib/libQt5Core.a $(OBJECTS)
$(LINKER) $(LFLAGS) -o $(DESTDIR_TARGET) $(OBJECTS) $(LIBS)
qmake: FORCE
#$(QMAKE) -o Makefile.Release buildwin.pro
qmake_all: FORCE
dist:
$(ZIP) buildwin.zip $(SOURCES) $(DIST) buildwin.pro ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/spec_pre.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/qdevice.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/device_config.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/common/angle.conf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/qconfig.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_bootstrap_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_concurrent.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_concurrent_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_core.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_core_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_dbus.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_dbus_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_gui.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_gui_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_network.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_network_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_opengl.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_opengl_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_openglextensions.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_openglextensions_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_platformsupport_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_printsupport.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_printsupport_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_sql.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_sql_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_testlib.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_testlib_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_widgets.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_widgets_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_xml.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_xml_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_lib_zlib_private.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qgenericbearer.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qico.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qminimal.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qnativewifibearer.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqlite.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqlmysql.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqlodbc.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqlpsql.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qsqltds.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qtuiotouchplugin.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_qwindows.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/modules/qt_plugin_windowsprintersupport.pri ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/qt_functions.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/qt_config.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/qt_config.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/win32-g++/qmake.conf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/spec_post.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/exclusive_builds.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/toolchain.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/default_pre.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/default_pre.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/resolve_config.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/exclusive_builds_post.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/default_post.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/build_pass.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/rtti.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/precompile_header.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/warn_on.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/qt.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/resources.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/moc.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/opengl.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/file_copies.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/win32/windows.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/testcase_targets.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/exceptions.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/yacc.prf ../../mxe/usr/i686-w64-mingw32.static/qt5/mkspecs/features/lex.prf buildwin.pro ../../mxe/usr/i686-w64-mingw32.static/qt5/lib/qtmain.prl ../../mxe/usr/i686-w64-mingw32.static/qt5/lib/Qt5Gui.prl ../../mxe/usr/i686-w64-mingw32.static/qt5/lib/Qt5Core.prl ../../mxe/usr/i686-w64-mingw32.static/qt5/plugins/platforms/qwindows.prl ../../mxe/usr/i686-w64-mingw32.static/qt5/plugins/imageformats/qico.prl NO_PCH_SOURCES RESOURCES HEADERS SOURCES OBJECTIVE_SOURCES YACCSOURCES YACCSOURCES LEXSOURCES
clean: compiler_clean
-$(DEL_FILE) release/test.o release/buildwin_plugin_import.o
distclean: clean
-$(DEL_FILE) /home/administrator/louis/buildwin/buildwin_plugin_import.cpp
-$(DEL_FILE) $(DESTDIR_TARGET)
-$(DEL_FILE) Makefile.Release
mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
check: first
benchmark: first
compiler_no_pch_compiler_make_all:
compiler_no_pch_compiler_clean:
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_moc_header_make_all:
compiler_moc_header_clean:
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean:
####### Compile
release/test.o: test.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/test.o test.cpp
release/buildwin_plugin_import.o: /home/administrator/louis/buildwin/buildwin_plugin_import.cpp
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o release/buildwin_plugin_import.o /home/administrator/louis/buildwin/buildwin_plugin_import.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:
Probably it is just a simple include mistake, or a wrong line in the makefiles
Thanks in advance for help

How Do I Configure Qmake for Cross Compilation?

What I have done so far is create two makefiles: a project makefile and a package makefile.The project makefile was,however, created using qmake. When I compile the package, I get an x86-64 binary which means the makefile is not cross compiling. How can I fix this?
Here's a the part where I believe the source of the problem:
CC = gcc
CXX = g++
DEFINES = -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_SHARED
CFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
CXXFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
INCPATH = -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I.
LINK = g++
LFLAGS = -m64 -Wl,-O1
LIBS = $(SUBLIBS) -L/usr/lib/x86_64-linux-gnu -lcrypto -lssl -lQtCore -lpthread
AR = ar cqs
RANLIB =
QMAKE = /usr/lib/x86_64-linux-gnu/qt4/bin/qmake
TAR = tar -cf
COMPRESS = gzip -9f
COPY = cp -f
SED = sed
COPY_FILE = $(COPY)
COPY_DIR = $(COPY) -r
STRIP = strip
INSTALL_FILE = install -m 644 -p
INSTALL_DIR = $(COPY_DIR)
INSTALL_PROGRAM = install -m 755 -p
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
I changed the first line "CC = gcc" to "CC ?=gcc" but it didn't fix the problem.