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)'