PDA

View Full Version : Qwtplot3d Problem -> Using QtCreator + MinGW



lhdamiani
14th March 2013, 18:10
Hello there,

I´m having some issues migrating a VS2010 project to QtCreator+MinGW (mingw is mandatory on this project because i have unix-developed 3rd part code embedded).
This project (wasn´t originally mine), so, i had to recompile qwt-6.0.2 and qwtplot3d using mingw to use it.


There is one issue regarding the 3d plot, it crashes exactly when i call the plot3d function.

ERROR: QWidget: Must construct a QApplication before a QPaintDevice

Any idea on what's happening over here?

I've found this: http://snacs.sourceforge.net/inst__scratch__win.html

"

QwtPlot3D

The QwtPlot3D (http://qwtplot3d.sourceforge.net) widget can be downloaded from http://qwtplot3d.sourceforge.net/web/navigation/download_frame.html

Extract qwtplot3d-0.2.7.zip to C:/libs/qwtplot3d-0.2.7

To compile qwtplot3d, change in C:/libs/qwtplot3d-0.2.7/qwtplot3d.pro the line

CONFIG += qt warn_on opengl thread zlib debug
to

CONFIG += qt warn_on opengl thread zlib release
to build qwtplot3d in release mode, otherwise you will get error: "QWidget: Must construct a QApplication before a QPaintDevice".

Moreover, before compiling qwtplot3d and if you use mingw-gcc, you must change in the qwtplot3d.pro this (source http://nxv.sourceforge.net):

win32:TEMPLATE = vclib
to this:

win32:TEMPLATE = lib
For gcc 4.4.0, you also have to add the line

add #include <stdio.h>
to the file qwt3d_function.cpp.

To compile qwtplot3d run in a Qt command prompt:

qmake qwtplot3d.pro
mingw32-make

"


by doing this, i ran into another problem, as seen below:

C:\qwtplot3d>mingw32-make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `C:/qwtplot3d'
g++ -c -pipe -O2 -fexceptions -mthreads -Wall -Wextra -frtti -DUNICODE -DQT_LARG
EFILE_SUPPORT -DQT_DLL -DQWT3D_DLL -DQWT3D_MAKEDLL -DQT_THREAD_SUPPORT -DQT_DLL
-DQT_NO_DEBUG -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE
_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -I"..\Qt\4.8.4\include\QtCo
re" -I"..\Qt\4.8.4\include\QtGui" -I"..\Qt\4.8.4\include\QtOpenGL" -I"..\Qt\4.8.
4\include" -I"include" -I"..\Qt\4.8.4\include\ActiveQt" -I"tmp" -I"..\Qt\4.8.4\m
kspecs\win32-g++" -o tmp\qwt3d_axis.o src\qwt3d_axis.cpp
In file included from include/qwt3d_types.h:26:0,
from include/qwt3d_drawable.h:7,
from include/qwt3d_label.h:10,
from include/qwt3d_axis.h:5,
from src\qwt3d_axis.cpp:1:
include/qwt3d_openglhelper.h: In function 'const GLubyte* Qwt3D::gl_error()':
include/qwt3d_openglhelper.h:68:31: error: 'gluErrorString' was not declared in
this scope
include/qwt3d_openglhelper.h:69:15: error: 'glu' was not declared in this scope
include/qwt3d_openglhelper.h:70:2: error: expected ';' before '}' token
include/qwt3d_openglhelper.h: In function 'bool Qwt3D::ViewPort2World(double&, d
ouble&, double&, double, double, double)':
include/qwt3d_openglhelper.h:106:97: error: 'gluUnProject' was not declared in t
his scope
include/qwt3d_openglhelper.h: In function 'bool Qwt3D::World2ViewPort(double&, d
ouble&, double&, double, double, double)':
include/qwt3d_openglhelper.h:122:95: error: 'gluProject' was not declared in thi
s scope
mingw32-make[1]: *** [tmp/qwt3d_axis.o] Error 1
mingw32-make[1]: Leaving directory `C:/qwtplot3d'
mingw32-make: *** [release] Error 2

lhdamiani
14th March 2013, 20:25
I added manually the glut files. it went through that part .. now i got a undefined reference error as follows

./tmp\qwt3d_io_gl2ps.o:qwt3d_io_gl2ps.cpp:(.text+0x1 09b) : undefined reference to `_imp__glLineWidth'
./tmp\qwt3d_io_gl2ps.o:qwt3d_io_gl2ps.cpp:(.text+0x1 0af) : undefined reference to `_imp__glLineWidth'
./tmp\qwt3d_io_gl2ps.o:qwt3d_io_gl2ps.cpp:(.text+0x1 12b) : undefined reference to `_imp__glPointSize'
./tmp\qwt3d_io_gl2ps.o:qwt3d_io_gl2ps.cpp:(.text+0x1 13f) : undefined reference to `_imp__glPointSize'
./tmp\qwt3d_io_gl2ps.o:qwt3d_io_gl2ps.cpp:(.text+0x1 17c ) : undefined reference to `_imp__glDrawPixels'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [lib\qwtplot3d.dll] Error 1
mingw32-make[1]: Leaving directory `C:/qwtplot3d'
mingw32-make: *** [release] Error 2

any idea?


my *.pro file is shown bellow:
# pro file for building the makefile for qwtplot3d
#

TARGET = qwtplot3d
TEMPLATE = lib
#CONFIG += qt warn_on opengl thread zlib debug
CONFIG += qt warn_on opengl thread zlib release
MOC_DIR = tmp
OBJECTS_DIR = tmp
INCLUDEPATH = include
DEPENDPATH = include src
DESTDIR = lib
#DESTDIR = ../../../lib
QT += opengl

#win32:TEMPLATE = vclib
win32:TEMPLATE = lib
win32:CONFIG += dll exceptions
win32:dll:DEFINES += QT_DLL QWT3D_DLL QWT3D_MAKEDLL
win32:QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_STL

# Comment the next line, if you have zlib on your windows system
win32:CONFIG -= zlib

linux-g++:TMAKE_CXXFLAGS += -fno-exceptions
unix:VERSION = 0.2.6

# Input
SOURCES += src/qwt3d_axis.cpp \
src/ qwt3d_color.cpp \
src /qwt3d_coordsys.cpp \
src/ qwt3d_drawable.cpp \
src/ qwt3d_mousekeyboard.cpp \
src/qwt3d_movements.cpp \
src/qwt3d_lighting.cpp \
src/qwt3d_colorlegend.cpp \
src/qwt3d_plot.cpp \
src/qwt3d_label.cpp \
src/qwt3d_types.cpp \
src/qwt3d_enrichment_std.cpp \
src/qwt3d_autoscaler.cpp \
src/qwt3d_io_reader.cpp \
src/qwt3d_io.cpp \
src/qwt3d_scale.cpp

SOURCES += src/qwt3d_gridmapping.cpp \
src/qwt3d_parametricsurface.cpp \
src/qwt3d_function.cpp

SOURCES += src/qwt3d_surfaceplot.cpp \
src/qwt3d_gridplot.cpp \
src/qwt3d_meshplot.cpp


HEADERS += include/qwt3d_color.h \
include/qwt3d_global.h \
include/qwt3d_types.h \
include/qwt3d_axis.h \
include/qwt3d_coordsys.h \
include/qwt3d_drawable.h \
include/qwt3d_helper.h \
include/qwt3d_label.h \
include/qwt3d_openglhelper.h \
include/qwt3d_colorlegend.h \
include/qwt3d_plot.h \
include/qwt3d_enrichment.h \
include/qwt3d_enrichment_std.h \
include/qwt3d_autoscaler.h \
include/qwt3d_autoptr.h \
include/qwt3d_io.h \
include/qwt3d_io_reader.h \
include/qwt3d_scale.h \
include/qwt3d_portability.h

HEADERS += include/qwt3d_mapping.h \
include/qwt3d_gridmapping.h \
include/qwt3d_parametricsurface.h \
include/qwt3d_function.h

HEADERS += include/qwt3d_surfaceplot.h \
include/qwt3d_volumeplot.h \
include/qwt3d_graphplot.h \
include/qwt3d_multiplot.h

# gl2ps support
HEADERS+=3rdparty/gl2ps/gl2ps.h \
include/qwt3d_io_gl2ps.h

SOURCES+=src/qwt3d_io_gl2ps.cpp \
3rdparty/gl2ps/gl2ps.c

# zlib support for gl2ps
zlib {
DEFINES += GL2PS_HAVE_ZLIB
win32:LIBS += zlib.lib
unix:LIBS += -lz
}