Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

which g++ parameters to use

33 views
Skip to first unread message

Hongliang Wang

unread,
Nov 12, 2014, 9:53:35 AM11/12/14
to
Hello all,

I just developed a small application using Qt/C++ and it was released on Windows platform. So the source code is fine.

But now I would like to migrate it to Linux platform as well. The problem is that I have not worked on Linux for more than one year so I forgot g++ parameters. Could anybody tell me what I did wrong based on following make output? Thanks in advance.

/home/loudking/Qt5.3.1/5.3/gcc/bin/moc -i DTMainWindow.h -o moc/moc_DTMainWindow.cpp
g++ -c -lstdc++ -fPIC -g3 -Wall -Wpointer-arith -Werror -Wformat=2 -W -I/home/loudking/Qt5.3.1/5.3/gcc/include -I/home/loudking/Qt5.3.1/5.3/gcc/include/QtGui -I/home/loudking/Qt5.3.1/5.3/gcc/include/QtCore -I/home/loudking/Qt5.3.1/5.3/gcc/include/QtWidgets DTMainWindow.cpp -o DTMainWindow.o
ar rc DragonTotem.a DTMainWindow.o
g++ -c -lstdc++ -fPIC -g3 -Wall -Wpointer-arith -Werror -Wformat=2 -W -I/home/loudking/Qt5.3.1/5.3/gcc/include -I/home/loudking/Qt5.3.1/5.3/gcc/include/QtGui -I/home/loudking/Qt5.3.1/5.3/gcc/include/QtCore -I/home/loudking/Qt5.3.1/5.3/gcc/include/QtWidgets main.cpp
g++ /home/loudking/Qt5.3.1/5.3/gcc/lib/libQt5Core.so /home/loudking/Qt5.3.1/5.3/gcc/lib/libQt5Gui.so /home/loudking/Qt5.3.1/5.3/gcc/lib/libQt5Widgets.so DragonTotem.a main.o -o main
main.o: In function `main':
/home/loudking/source/base/main.cpp:17: undefined reference to `QApplication::QApplication(int&, char**, int)'
/home/loudking/source/base/main.cpp:18: undefined reference to `DTMainWindow::DTMainWindow(QWidget*)'
/home/loudking/source/base/main.cpp:20: undefined reference to `QWidget::show()'
/home/loudking/source/base/main.cpp:21: undefined reference to `qFlagLocation(char const*)'
/home/loudking/source/base/main.cpp:21: undefined reference to `qFlagLocation(char const*)'
/home/loudking/source/base/main.cpp:21: undefined reference to `QObject::connect(QObject const*, char const*, QObject const*, char const*, Qt::ConnectionType)'
/home/loudking/source/base/main.cpp:21: undefined reference to `QMetaObject::Connection::~Connection()'
/home/loudking/source/base/main.cpp:23: undefined reference to `QApplication::exec()'
/home/loudking/source/base/main.cpp:18: undefined reference to `DTMainWindow::~DTMainWindow()'
/home/loudking/source/base/main.cpp:23: undefined reference to `QApplication::~QApplication()'
/home/loudking/source/base/main.cpp:18: undefined reference to `DTMainWindow::~DTMainWindow()'
/home/loudking/source/base/main.cpp:23: undefined reference to `QApplication::~QApplication()'
collect2: error: ld returned 1 exit status
make: *** [main] Error 1

Reinhardt Behm

unread,
Nov 12, 2014, 9:06:28 PM11/12/14
to
Hongliang Wang wrote:

> Hello all,
>
> I just developed a small application using Qt/C++ and it was released on
> Windows platform. So the source code is fine.
>
> But now I would like to migrate it to Linux platform as well. The problem
> is that I have not worked on Linux for more than one year so I forgot g++
> parameters. Could anybody tell me what I did wrong based on following make
> output? Thanks in advance.
>
<snip>

Why don't you use qmake. It will normally take care of setting up your
makefile with all needed options.

--
Reinhardt

0 new messages