How to build QT Project from terminal MacOS X - qt

For example, lets take a default QT widget application that we get. So instead of using QT Creator if we want to build using the terminal then what is the way to do that?
Basically we want to produce the build for the project which actually also contains the dmg file.
Compile output when done using QT Creator shown is below when no change is done :
14:37:04: Running steps for project QTDefaultProj...
14:37:04: Configuration unchanged, skipping qmake step.
14:37:04: Starting: "/usr/bin/make"
make: Nothing to be done for `first'.
14:37:05: The process "/usr/bin/make" exited normally.
14:37:05: Elapsed time: 00:00.
Compile Output after changing the directory :
15:31:50: Running steps for project QTDefaultProj...
15:31:50: Starting: "/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/bin/qmake" /Users/arqam/Desktop/Junk/QTDefaultProj/QTDefaultProj.pro -spec macx-clang CONFIG+=debug CONFIG+=x86_64 CONFIG+=qml_debug
Info: creating stash file /Users/arqam/Desktop/Junk/build-QTDefaultProj-Desktop_Qt_5_10_0_clang_64bit-Debug-2/.qmake.stash
15:31:50: The process "/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/bin/qmake" exited normally.
15:31:50: Starting: "/usr/bin/make" qmake_all
make: Nothing to be done for `qmake_all'.
15:31:51: The process "/usr/bin/make" exited normally.
15:31:51: Starting: "/usr/bin/make"
/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/bin/uic ../QTDefaultProj/mainwindow.ui -o ui_mainwindow.h
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -g -std=gnu++11 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.10 -Wall -W -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../QTDefaultProj -I. -I../../ImageToCartoon/QT/5.10.0/clang_64/lib/QtWidgets.framework/Headers -I../../ImageToCartoon/QT/5.10.0/clang_64/lib/QtGui.framework/Headers -I../../ImageToCartoon/QT/5.10.0/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I../../ImageToCartoon/QT/5.10.0/clang_64/mkspecs/macx-clang -F/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/lib -o main.o ../QTDefaultProj/main.cpp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -g -std=gnu++11 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.10 -Wall -W -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../QTDefaultProj -I. -I../../ImageToCartoon/QT/5.10.0/clang_64/lib/QtWidgets.framework/Headers -I../../ImageToCartoon/QT/5.10.0/clang_64/lib/QtGui.framework/Headers -I../../ImageToCartoon/QT/5.10.0/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I../../ImageToCartoon/QT/5.10.0/clang_64/mkspecs/macx-clang -F/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/lib -o mainwindow.o ../QTDefaultProj/mainwindow.cpp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -pipe -stdlib=libc++ -g -std=gnu++11 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.10 -Wall -W -dM -E -o moc_predefs.h ../../ImageToCartoon/QT/5.10.0/clang_64/mkspecs/features/data/dummy.cpp
/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/bin/moc -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB --include ./moc_predefs.h -I/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/mkspecs/macx-clang -I/Users/arqam/Desktop/Junk/QTDefaultProj -I/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/lib/QtWidgets.framework/Headers -I/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/lib/QtGui.framework/Headers -I/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1 -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/8.1.0/include -I/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include -F/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/lib ../QTDefaultProj/mainwindow.h -o moc_mainwindow.cpp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -g -std=gnu++11 -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.10 -Wall -W -fPIC -DQT_DEPRECATED_WARNINGS -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../QTDefaultProj -I. -I../../ImageToCartoon/QT/5.10.0/clang_64/lib/QtWidgets.framework/Headers -I../../ImageToCartoon/QT/5.10.0/clang_64/lib/QtGui.framework/Headers -I../../ImageToCartoon/QT/5.10.0/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I../../ImageToCartoon/QT/5.10.0/clang_64/mkspecs/macx-clang -F/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/lib -o moc_mainwindow.o moc_mainwindow.cpp
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -stdlib=libc++ -headerpad_max_install_names -arch x86_64 -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -mmacosx-version-min=10.10 -Wl,-rpath,#executable_path/Frameworks -Wl,-rpath,/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/lib -o QTDefaultProj.app/Contents/MacOS/QTDefaultProj main.o mainwindow.o moc_mainwindow.o -F/Users/arqam/Desktop/ImageToCartoon/QT/5.10.0/clang_64/lib -framework QtWidgets -framework QtGui -framework QtCore -framework DiskArbitration -framework IOKit -framework OpenGL -framework AGL
15:31:55: The process "/usr/bin/make" exited normally.
15:31:55: Elapsed time: 00:05.

With help from m7913d I am finally able to build the QT project from terminal without using QT Creator.
So steps are :
Create an empty folder name it as build-debug for example.
Inside your build-debug folder run the following command :
pathToQTDirectory/QT/5.10.0/clang_64/bin/qmake pathToQTProjectFolder/MyProject/
/usr/bin/make qmake_all
/usr/bin/make
If the above doesn't work then try seeing in the QT Creator compiler output the steps involved when you specify a new directory as the build directory.

Related

Mac OS X R error “ld: framework not found CoreFoundation”

I need to recompile some old functions to work r again (I had no problem with them back in 2016). Here are the commands and the error msg:
system("R CMD SHLIB rk4_mod_r.f90 derive_rossler.f90 simulate_rk4.f90 -o simulate_rossler_rk4.so");
gfortran -arch x86_64 -fPIC -g -O2 -c rk4_mod_r.f90 -o rk4_mod_r.o
gfortran -arch x86_64 -fPIC -g -O2 -c derive_rossler.f90 -o derive_rossler.o
gfortran -arch x86_64 -fPIC -g -O2 -c simulate_rk4.f90 -o simulate_rk4.o
gfortran -arch x86_64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/clang4/lib -o simulate_rossler_rk4.so rk4_mod_r.o derive_rossler.o simulate_rk4.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: framework not found CoreFoundation
collect2: error: ld returned 1 exit status
make: *** [simulate_rossler_rk4.so] Error 1
~.R/Makevars is as follows
VER=-8
CC=gcc$(VER)
CXX=g++$(VER)
CXX11=g++$(VER)
CXX14=g++$(VER)
CXX17=g++$(VER)
CFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
CXXFLAGS=-mtune=native -g -O2 -Wall -pedantic -Wconversion
FLIBS=-L/usr/local/Cellar/gcc/8.3.0/lib/gcc/8
I noticed that -L/usr/local/clang4/lib is there. I am not sure if that is correct. I tried the same command by replacing it to -L/usr/local/Cellar/gcc/8.3.0/lib/gcc/8 to no avail.
What am I missing?
Many thanks,
Ed

How to disable C++11 in qmake?

Project file:
CONFIG -= qt
QMAKE_CXXFLAGS += -std=c++98
QMAKE_CXXFLAGS -= -std=c++11
QMAKE_CXXFLAGS -= -std=gnu++11
CONFIG -= c++11
Result:
g++ -c -pipe -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-but-set-variable -Wno-reorder -Wno-missing-field-initializers -std=c++98 -DDEBUG -g -std=gnu++11 -Wall -W -fPIC -DQT_QML_DEBUG -I../../qqq -I. -I../src/jsoncpp -I../lib -I../../../../Qt/5.9.1/gcc_64/mkspecs/linux-g++ -o ../build/debug/obj/TaskManager.o ../src/TaskManager.cpp
g++ -c -pipe -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-but-set-variable -Wno-reorder -Wno-missing-field-initializers -std=c++98 -DDEBUG -g -std=gnu++11 -Wall -W -fPIC -DQT_QML_DEBUG -I../../qqq -I. -I../src/jsoncpp -I../lib -I../../../../Qt/5.9.1/gcc_64/mkspecs/linux-g++ -o ../build/debug/obj/Utils.o ../src/Utils.cpp
As you see option -std=gnu++11 still exist (no any reactoion to "QMAKE_CXXFLAGS -="/"CONFIG -=").
Qt:
Qt Creator 4.3.1
Based on Qt 5.9.1 (GCC 5.3.1 20160406 (Red Hat 5.3.1-6), 64 bit)
Built on Jun 29 2017 04:10:39
Thank you a lot.
P.S. I have compatibility troubles with gnu++11 (c++ with gcc extenstions) on clean system
./qqq: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./qqq)
./qqq: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by ./qqq)
./qqq: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.21' not found
and want to use c++11 (c++ without gcc extenstions) instead gnu++11 without any extenstions but I cannot to disable it :-(

Strange Path when compile qt app for qnx

I try to compile my app, QNX and Qt is all set.
in line 3.
C:/QNX650/target/qnx6armle-v7 is in the QNX_TARGET env var, and C:/QNX650/host/win32/x86 is QNX_HOST env var. this is strange they combine together.
Qtcreator, debug mode.this is the only output
qcc -Vgcc_ntoarmv7le -c -Wno-psabi -lang-c++ -g -Wall -W -D_REENTRANT -fPIE -DQT_NO_CLIPBOARD -DHMI_PLUGIN_DEBUG -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_QUICK_LIB -DQT_QML_LIB -DQT_NETWORK_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../../../QtQNX/Qt5.0.2/5.0.2/qnx_armv7le/mkspecs/qnx-armv7le-qcc -I../MQueue_Demo -I../MQueue_Demo/qtquick2applicationviewer -I../MQueue_Demo/depends/MQueue/include -I../MQueue_Demo/depends/MQueue/include/native -I../MQueue_Demo/depends/hmi_interfaces -I../../../../QtQNX/Qt5.0.2/5.0.2/qnx_armv7le/include -I../../../../QtQNX/Qt5.0.2/5.0.2/qnx_armv7le/include/QtQuick -I../../../../QtQNX/Qt5.0.2/5.0.2/qnx_armv7le/include/QtQml -I../../../../QtQNX/Qt5.0.2/5.0.2/qnx_armv7le/include/QtNetwork -I../../../../QtQNX/Qt5.0.2/5.0.2/qnx_armv7le/include/QtGui -I../../../../QtQNX/Qt5.0.2/5.0.2/qnx_armv7le/include/QtGui/5.0.2 -I../../../../QtQNX/Qt5.0.2/5.0.2/qnx_armv7le/include/QtGui/5.0.2/QtGui -I../../../../QtQNX/Qt5.0.2/5.0.2/qnx_armv7le/include/QtCore -I. -IC:\QNX650\target\qnx6\armle-v7/target/qnx6/usr/include -IC:\QNX650\target\qnx6\armle-v7/target/qnx6/usr/include/freetype2 -I. -o main.obj ../MQueue_Demo/main.cpp
cc: unknown target 'gcc_ntoarmv7le+debug'
cc: no targets defined in C:/QNX650/target/qnx6/armle-v7/host/win32/x86/etc/qcc!
make: *** [main.obj] Error 1
09:46:25: The process "C:\QNX650\host\win32\x86\usr\bin\make.exe" exited with code 2.

Configure Qt library 4.8.1 error when I cross compile

I’m compiling the Qt with phonon and phonon-backend for my embedded board.
I type:
./configure -embedded arm -xplatform qws/linux-arm-g++ -qt-mouse-tslib -L/home/user/ev-sdk/rootfs/arm-a8-fs/usr/lib -L/home/user/Desktop/qt-everywhere-opensource-src-4.8.1/lib -I/home/user/ev-sdk/rootfs/arm-a8-fs/usr/include -I/home/user/ev-sdk/rootfs/arm-a8-fs/usr/include/freetype2/freetype/config -prefix /opt/qt_eng -little-endian -no-gif -no-libtiff -no-libmng -no-openssl -no-opengl -no-mmx -no-3dnow -no-sse -no-sse2 -no-largefile -no-sm -svg -v -no-feature-cursor -fast -opensource -release -no-multimedia -no-cups -no-nis -no-exceptions -nomake examples -nomake demos -no-sql-sqlite -no-g++-exceptions -phonon -phonon-backend -DQT_NO_QWS_CURSOR -DQT_THREAD_SUPPORT
with qmake.conf in /home/user/Desktop/qt-everywhere-opensource-src-4.8.1/mkspecs/qws/linux-arm-g++:
#
# qmake configuration for building with arm-linux-g++ #
include(../../common/gcc-base.conf)
include(../../common/gcc-base-unix.conf)
include(../../common/g++.conf)
include(../../common/linux.conf)
include(../../common/qws.conf)
QMAKE_CFLAGS_RELEASE = -O3 -march=armv7-a -mtune=cortex-a8
-mfpu=neon -mfloat-abi=softfp
DEFINES +=
# modifications to g++.conf
QMAKE_CC = sb2 -t imx53 gcc
QMAKE_CXX = sb2 -t imx53 g++
QMAKE_LINK = sb2 -t imx53 g++
QMAKE_LINK_SHLIB = sb2 -t imx53 g++
# modifications to linux.conf
QMAKE_AR = sb2 -t imx53 ar cqs
QMAKE_OBJCOPY = sb2 -t imx53 objcopy
QMAKE_STRIP = sb2 -t imx53 strip
load(qt_config)
If I remove -phonon -phonon-backend from option the compilation is successful.
If I put -phonon -phonon-backend
I have this error:
.
.
.
D-Bus auto-detection... ()
Project WARNING: Your mkspec is including 'common/g++.conf', but the mkspecs have been refactored
To fix this include 'common/gcc-base-.conf and 'common/g++-.conf' instead
sb2 -t imx53 g++ -c -pipe -pipe -pipe -pipe -pipe -pipe -O2 -O2 -O2 -O2 -O2 -O2 -Wall -W -Wall -W -Wall -W -Wall -W -Wall -W -Wall -W -I../../../mkspecs/qws/linux-arm-g++ -I. -I/home/user/ev-sdk/rootfs/arm-a8-fs/usr/include -I/home/user/ev-sdk/rootfs/arm-a8-fs/usr/include/freetype2/freetype/config -I/usr/lib/glib-2.0/include -I/usr/include/glib-2.0 -o dbus.o dbus.cpp
dbus.cpp:43:23: error: dbus/dbus.h: No such file or directory
dbus.cpp:46:2: error: #error Needs at least dbus version 1
dbus.cpp: In function 'int main(int, char**)':
dbus.cpp:51: error: 'dbus_shutdown' was not declared in this scope
make: *** [dbus.o] Error 1
D-Bus disabled.
Glib auto-detection... ()
Project WARNING: Your mkspec is including 'common/g++.conf', but the mkspecs have been refactored
To fix this include 'common/gcc-base-.conf and 'common/g++-.conf' instead
sb2 -t imx53 g++ -c -pipe -pipe -pipe -pipe -pipe -pipe -O2 -O2 -O2 -O2 -O2 -O2 -Wall -W -Wall -W -Wall -W -Wall -W -Wall -W -Wall -W -I../../../mkspecs/qws/linux-arm-g++ -I. -I/home/user/ev-sdk/rootfs/arm-a8-fs/usr/include -I/home/user/ev-sdk/rootfs/arm-a8-fs/usr/include/freetype2/freetype/config -I/usr/lib/glib-2.0/include -I/usr/include/glib-2.0 -o glib.o glib.cpp
glib.cpp: In function 'int main(int, char**)':
glib.cpp:55: warning: 'pollfd' is used uninitialized in this function
sb2 -t imx53 g++ -Wl,-O1 -o glib glib.o -L/home/user/ev-sdk/rootfs/arm-a8-fs/usr/lib -L/home/user/Desktop/qt-everywhere-opensource-src-4.8.1/lib
*glib.o: In function `main':
glib.cpp:(.text+0x10): undefined reference to `g_thread_init'
glib.cpp:(.text+0x14): undefined reference to `g_main_context_default'
glib.cpp:(.text+0x20): undefined reference to `g_source_new'
glib.cpp:(.text+0x28): undefined reference to `g_source_add_poll'
glib.cpp:(.text+0x38): undefined reference to `g_threads_got_initialized'
collect2: ld returned 1 exit status
make: *** [glib] Error 1*
Glib disabled.
Phonon support cannot be enabled due to functionality tests!
Turn on verbose messaging (-v) to ./configure to see the final report.
If you believe this message is in error you may use the continue
switch (-continue) to ./configure to continue.
I lost the last two days to understand why giving error.
Could someone help me?
Debian/linux can use:
$ sudo apt-get install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
The command can be run before run ./configure
QMAKE_LIBDIR += -L$${ROOTFS_DIR}/usr/lib
QMAKE_CFLAGS += -I$${ROOTFS_DIR}/usr/include/glib-2.0
QMAKE_CFLAGS += -I$${ROOTFS_DIR}/usr/lib/glib-2.0/include
QMAKE_LIBS += -lgthread-2.0 -lglib-2.0 -v

Qt error: undefined reference to 'gluOrtho2D'

I have the same error than here. There's no solution there and also I'm gonna try to explain it more clearly so hopefully someone has the solution. Also I've installed everything from the answer to this question.
I'm trying to compile a program that a friend has done in QT (linux). I've tryed it on Windows and it runs just fine, the problem is that I can't run it on Ubuntu 11.10.
This is the compiling output at QT:
...
glwidget.o:glwidget.cpp:function GLWidget::resizeGL(int, int): error: undefined reference to 'gluOrtho2D'
glwidget.o:glwidget.cpp:function GLWidget::projectScene(): error: undefined reference to 'gluOrtho2D'
make: Leaving directory...
collect2: ld returned 1 exit status
make: *** [QTapplication] Error 1
...
glu.h and gl.h are #included.
QT += opengl is put at the .pro
I don't know if it's problem of Ubuntu 11.10. I've read that it has some problems with the linker though I downloaded "binutils-gold" that supposedly fixed it. Also I've tryed to add manually the library with right click over the projects' .pro->Add Librarys, but it won't let me add nothing at "/usr/include/GL".
Finally, here's the complete compile output:
make: Entering directory `/home/daniel/Escritorio/Practica3-build-desktop-Desktop_Qt_4_8_0_for_GCC__Qt_SDK__Release'
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../QtSDK/Desktop/Qt/4.8.0/gcc/mkspecs/linux-g++ -I../Practica3 -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtCore -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtGui -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtOpenGL -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include -I../Practica3/SceneObjects -I../Practica3/SceneObjects/Auxiliar -I/usr/X11R6/include -I. -I. -I../Practica3 -I. -o main.o ../Practica3/main.cpp
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../QtSDK/Desktop/Qt/4.8.0/gcc/mkspecs/linux-g++ -I../Practica3 -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtCore -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtGui -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtOpenGL -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include -I../Practica3/SceneObjects -I../Practica3/SceneObjects/Auxiliar -I/usr/X11R6/include -I. -I. -I../Practica3 -I. -o mainwindow.o ../Practica3/mainwindow.cpp
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../QtSDK/Desktop/Qt/4.8.0/gcc/mkspecs/linux-g++ -I../Practica3 -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtCore -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtGui -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtOpenGL -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include -I../Practica3/SceneObjects -I../Practica3/SceneObjects/Auxiliar -I/usr/X11R6/include -I. -I. -I../Practica3 -I. -o glwidget.o ../Practica3/glwidget.cpp
../Practica3/glwidget.cpp:120:6: warning: unused parameter 'event' [-Wunused-parameter]
/home/daniel/QtSDK/Desktop/Qt/4.8.0/gcc/bin/moc -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../QtSDK/Desktop/Qt/4.8.0/gcc/mkspecs/linux-g++ -I../Practica3 -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtCore -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtGui -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtOpenGL -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include -I../Practica3/SceneObjects -I../Practica3/SceneObjects/Auxiliar -I/usr/X11R6/include -I. -I. -I../Practica3 -I. ../Practica3/mainwindow.h -o moc_mainwindow.cpp
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../QtSDK/Desktop/Qt/4.8.0/gcc/mkspecs/linux-g++ -I../Practica3 -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtCore -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtGui -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtOpenGL -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include -I../Practica3/SceneObjects -I../Practica3/SceneObjects/Auxiliar -I/usr/X11R6/include -I. -I. -I../Practica3 -I. -o moc_mainwindow.o moc_mainwindow.cpp
/home/daniel/QtSDK/Desktop/Qt/4.8.0/gcc/bin/moc -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../QtSDK/Desktop/Qt/4.8.0/gcc/mkspecs/linux-g++ -I../Practica3 -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtCore -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtGui -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtOpenGL -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include -I../Practica3/SceneObjects -I../Practica3/SceneObjects/Auxiliar -I/usr/X11R6/include -I. -I. -I../Practica3 -I. ../Practica3/glwidget.h -o moc_glwidget.cpp
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../QtSDK/Desktop/Qt/4.8.0/gcc/mkspecs/linux-g++ -I../Practica3 -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtCore -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtGui -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include/QtOpenGL -I../../QtSDK/Desktop/Qt/4.8.0/gcc/include -I../Practica3/SceneObjects -I../Practica3/SceneObjects/Auxiliar -I/usr/X11R6/include -I. -I. -I../Practica3 -I. -o moc_glwidget.o moc_glwidget.cpp
g++ -Wl,-O1 -Wl,-rpath,/home/daniel/QtSDK/Desktop/Qt/4.8.0/gcc/lib -o Practica3 main.o mainwindow.o glwidget.o scene.o pv2d.o regularpolygon.o obstacle.o sceneobject.o rectangle.o paintableobject.o segment.o point.o pen.o bouncingball.o circle.o moc_mainwindow.o moc_glwidget.o -L/home/daniel/QtSDK/Desktop/Qt/4.8.0/gcc/lib -L/usr/X11R6/lib -lQtOpenGL -lQtGui -lQtCore -lGL -lpthread
glwidget.o:glwidget.cpp:function GLWidget::resizeGL(int, int): error: undefined reference to 'gluOrtho2D'
make: Leaving directory `/home/daniel/Escritorio/Practica3-build-desktop-Desktop_Qt_4_8_0_for_GCC__Qt_SDK__Release'
glwidget.o:glwidget.cpp:function GLWidget::projectScene(): error: undefined reference to 'gluOrtho2D'
collect2: ld returned 1 exit status
make: *** [Practica3] Error 1
16:44:35: The process "/usr/bin/make" exited with code 2.
Error while building project Practica3 (target: Desktop)
When executing build step 'Make'
You need to add the relevant libraries to the linker options.
Libraries are added with -l options (lower-case L). They are not paths, but actual files that contain code. On Linux, those files have .so* extensions. On Windows, those are .dll files. Extensions vary on other platforms.
One of the questions you link states that you need the following libraries:
-lglut -lGL -lGLU -lGLEW
(gluOrtho2D is actually in libGLU, but you might be missing others.)
Read your IDE's docs to see how you're supposed to add those to the linker options, but many allow you to enter them just like that in the right area of the project settings.
If those libraries are not in the usual library paths on your machine (/lib, /usr/lib on Linux, possibly /lib64 and /usr/lib64, or same with 32 instead), you'll have to tell the linker to look in other directories.
For that, either your IDE has another option for linker search paths, or you can specify them in the same spot as the actual libraries. You use the -L switch for that.
-L for search paths, -l for libraries.
Recap: if you want to link with libsuperfoo.so that is in /usr/local/bar/libs, then the correct linker options are:
-L/usr/local/bar/libs -lsuperfoo
If you're using qmake, the only thing you need to add to the .pro file is (for the above hypothetical library):
LIBS += -L/usr/local/bar/libs -lsuperfoo
In windows, adding
LIBS += -lopengl32 -lglu32
in the .pro file and
#include<GL/glu.h>
in the source file solves the issue.

Resources