[Qgis-developer] qgis api problem

Speiser Ferenc ferenc.speiser at gmail.com
Wed Apr 22 10:10:09 EDT 2009


Dear List,

I need some help, i am stucked with building Tim Sutton's tutorial1  
with qt. Do you have any idea about the solution?

I am trying to build Tim's first tutorial about qgis mapcanvas api on  
macosx leopard with qtcreator ide, I have qgis1.0.0 installed.

- the tutorial has been checked out from the svn.
- Q_OBJECT is in the headers.

It's working with cmake, if I copy the following libs in the build  
directory.
libgdal.1.dylib		libgeotiff.1.dylib	libjpeg.62.dylib	libqgis_core. 
1.0.dylib	libxerces-c.28.dylib
libgeos.3.dylib		libgif.4.dylib		libpq.5.dylib		libqgis_gui.1.0.dylib
libgeos_c.1.dylib	libjasper.1.dylib	libproj.0.dylib		libtiff.3.dylib

If not, it gives error:
Scanning dependencies of target timtut1
[100%] Building CXX object CMakeFiles/timtut1.dir/main.o
Linking CXX executable timtut1
ld: file not found: @executable_path/lib/libproj.0.dylib
collect2: ld returned 1 exit status
make[2]: *** [timtut1] Error 1
make[1]: *** [CMakeFiles/timtut1.dir/all] Error 2
make: *** [all] Error 2


Perhaps the problem is that the qmake can't find the libs? They are  
added to the .pro file, and they are in the g++ make command also.

Below you can find my .pro file and the build message. I have a lot of  
undefined symbols an I don't know why.


What does these undefined symbols mean? I haven't included a lib?
Undefined symbols:
"QgsVectorLayer::select(int, bool)", referenced from:
QgsVectorLayer::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsvectorlayer.o
QgsVectorLayer::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsvectorlayer.o....

Thanks for your help in advance!

Best wishes!
Feri

My .pro file:
# -------------------------------------------------
# Project created by QtCreator 2009-04-15T16:58:28
# -------------------------------------------------
TEMPLATE = app
TARGET = qgis_test
QT = qt3support \
sql \
opengl \
network \
svg \
gui \
core \
xml
LANGUAGE = C++
QGISDIR = /Applications/qgis1.0.0.app/Contents/MacOS/
QGISLIBDIR = /Applications/qgis1.0.0.app/Contents/MacOS/lib
# QGISSRCDIR=/home/user/Desktop/qgis_0.9.1/qgis_0.9.1/src
QGISPLUGINDIR = $${QGISLIBDIR}/qgis
DEFINES += QGISPLUGINDIR=$${QGISPLUGINDIR} \
CORE_EXPORT= \
UI_EXPORT= \
GUI_EXPORT=
INCLUDEPATH += /Applications/qgis1.0.0.app/Contents/MacOS/include/qgis \
/Library/Frameworks/GDAL.framework/unix/include
CONFIG += qt \
gui \
exceptions \
stl \
warn_on \
debug \
thread
LIBS += -L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libqgis_core. 
1.0.dylib \
-L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libqgis_gui.1.0.dylib \
# -L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libgdal.1.dylib \
-L/Library/Frameworks/GDAL.framework/Versions/1.6/unix/lib/ 
libgdal.dylib \
-L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libgeotiff.1.dylib \
-L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libjpeg.62.dylib \
-L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libqgis_core. 
1.0.dylib \
-L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libxerces-c.28.dylib \
-L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libgeos.3.dylib \
-L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libgif.4.dylib \
-L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libpq.5.dylib \
-L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libqgis_gui.1.0.dylib \
-L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libgeos_c.1.dylib \
-L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libjasper.1.dylib \
-L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libproj.0.dylib \
-L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libtiff.3.dylib
SOURCES += main.cpp \
mainwindow.cpp
HEADERS += mainwindow.h \
include/qgsapplication.h \
include/qgsproviderregistry.h \
include/qgssinglesymbolrenderer.h \
include/qgsmaplayerregistry.h \
include/qgsvectorlayer.h \
include/qgsmapcanvas.h
FORMS += mainwindow.ui


During the build i get the following message:
Running build steps for project qgis_test...
Creating gdb macros library...
Configuration unchanged, skipping QMake step.
Starting: /usr/bin/make debug -w
make: Entering directory `/Users/speiserf/workspace/qgis_test'
/usr/bin/make -f Makefile.Debug
make[1]: Entering directory `/Users/speiserf/workspace/qgis_test'
g++ -headerpad_max_install_names -o qgis_test.app/Contents/MacOS/ 
qgis_test debug/main.o debug/mainwindow.o debug/moc_mainwindow.o debug/ 
moc_qgsmaplayerregistry.o debug/moc_qgsvectorlayer.o debug/ 
moc_qgsmapcanvas.o -F/Library/Frameworks -L/Library/Frameworks -L/ 
Applications/qgis1.0.0.app/Contents/MacOS/lib/libqgis_core.1.0.dylib - 
L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libqgis_gui.1.0.dylib - 
L/Library/Frameworks/GDAL.framework/Versions/1.6/unix/lib/ 
libgdal.dylib -L/Applications/qgis1.0.0.app/Contents/MacOS/lib/ 
libgeotiff.1.dylib -L/Applications/qgis1.0.0.app/Contents/MacOS/lib/ 
libjpeg.62.dylib -L/Applications/qgis1.0.0.app/Contents/MacOS/lib/ 
libxerces-c.28.dylib -L/Applications/qgis1.0.0.app/Contents/MacOS/lib/ 
libgeos.3.dylib -L/Applications/qgis1.0.0.app/Contents/MacOS/lib/ 
libgif.4.dylib -L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libpq. 
5.dylib -L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libgeos_c. 
1.dylib -L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libjasper. 
1.dylib -L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libproj. 
0.dylib -L/Applications/qgis1.0.0.app/Contents/MacOS/lib/libtiff. 
3.dylib -framework QtSvg -framework Qt3Support -lresolv -framework  
QtSql -framework QtXml -framework QtOpenGL -framework QtGui -framework  
Carbon -framework AppKit -framework QtNetwork -framework  
SystemConfiguration -framework QtCore -lz -lm -framework  
ApplicationServices -framework OpenGL -framework AGL
Undefined symbols:
"QgsVectorLayer::select(int, bool)", referenced from:
QgsVectorLayer::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsvectorlayer.o
QgsVectorLayer::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsvectorlayer.o
"QgsVectorLayer::drawLabels(QgsRenderContext&)", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsMapCanvas::connectNotify(char const*)", referenced from:
vtable for QgsMapCanvasin moc_qgsmapcanvas.o
"QgsMapLayer::loadDefaultStyle(bool&)", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsVectorLayer::updateFeatureCount() const", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsVectorLayer::subsetString()", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsMapCanvas::mouseReleaseEvent(QMouseEvent*)", referenced from:
vtable for QgsMapCanvasin moc_qgsmapcanvas.o
"QgsVectorLayer::featureCount() const", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsMapLayer::loadNamedStyle(QString, bool&)", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsVectorLayer::setSubsetString(QString)", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsMapCanvas::keyPressEvent(QKeyEvent*)", referenced from:
vtable for QgsMapCanvasin moc_qgsmapcanvas.o
"QgsMapLayer::staticMetaObject", referenced from:
QgsVectorLayer::staticMetaObject in moc_qgsvectorlayer.o
"QgsMapLayer::saveNamedStyle(QString, bool&)", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsVectorLayer::removeSelection(bool)", referenced from:
QgsVectorLayer::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsvectorlayer.o
QgsVectorLayer::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsvectorlayer.o
"QgsApplication::~QgsApplication()", referenced from:
_main in main.o
_main in main.o
"QgsMapCanvas::selectionChangedSlot()", referenced from:
QgsMapCanvas::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsmapcanvas.o
"QgsMapLayer::lastError()", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsMapCanvas::refresh()", referenced from:
_main in main.o
QgsMapCanvas::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsmapcanvas.o
"QgsMapCanvas::mapUnitsChanged()", referenced from:
QgsMapCanvas::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsmapcanvas.o
"QgsSingleSymbolRenderer 
::QgsSingleSymbolRenderer(QGis::GeometryType)", referenced from:
_main in main.o
"non-virtual thunk to QgsMapCanvas::~QgsMapCanvas()", referenced from:
vtable for QgsMapCanvasin moc_qgsmapcanvas.o
"QgsMapLayer::qt_metacall(QMetaObject::Call, int, void**)", referenced  
from:
QgsVectorLayer::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsvectorlayer.o
"QgsVectorLayer::~QgsVectorLayer()", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsVectorLayer::writeXml(QDomNode&, QDomDocument&)", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsMapCanvas::enableAntiAliasing(bool)", referenced from:
_main in main.o
"QgsVectorLayer::triggerRepaint()", referenced from:
QgsVectorLayer::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsvectorlayer.o
"non-virtual thunk to QgsMapCanvas::~QgsMapCanvas()", referenced from:
vtable for QgsMapCanvasin moc_qgsmapcanvas.o
"QgsMapLayer::setLayerOrder(QStringList)", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsMapCanvas::updateMap()", referenced from:
QgsMapCanvas::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsmapcanvas.o
"QgsVectorLayer::~QgsVectorLayer()", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsVectorLayer::writeSymbology(QDomNode&, QDomDocument&, QString&)  
const", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsMapCanvas::mousePressEvent(QMouseEvent*)", referenced from:
vtable for QgsMapCanvasin moc_qgsmapcanvas.o
"QgsMapLayerRegistry::connectNotify(char const*)", referenced from:
vtable for QgsMapLayerRegistryin moc_qgsmaplayerregistry.o
"QgsMapLayerRegistry::~QgsMapLayerRegistry()", referenced from:
vtable for QgsMapLayerRegistryin moc_qgsmaplayerregistry.o
"QgsVectorLayer::copySymbologySettings(QgsMapLayer const&)",  
referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsProviderRegistry::instance(QString)", referenced from:
_main in main.o
"QgsMapLayer::loadNamedStyleFromDb(QString, QString, QString&)",  
referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsMapCanvas::setExtent(QgsRect const&)", referenced from:
_main in main.o
"QgsMapLayerRegistry::instance()", referenced from:
_main in main.o
"QgsMapCanvas::keyReleaseEvent(QKeyEvent*)", referenced from:
vtable for QgsMapCanvasin moc_qgsmapcanvas.o
"QgsMapCanvas::setRenderFlag(bool)", referenced from:
QgsMapCanvas::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsmapcanvas.o
"QgsMapCanvas::mouseMoveEvent(QMouseEvent*)", referenced from:
vtable for QgsMapCanvasin moc_qgsmapcanvas.o
"QgsMapCanvas::readProject(QDomDocument const&)", referenced from:
QgsMapCanvas::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsmapcanvas.o
"QgsMapLayerRegistry::~QgsMapLayerRegistry()", referenced from:
vtable for QgsMapLayerRegistryin moc_qgsmaplayerregistry.o
"QgsVectorLayer::draw(QgsRenderContext&)", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsMapCanvas::saveAsImage(QString, QPixmap*, QString)", referenced  
from:
QgsMapCanvas::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsmapcanvas.o
QgsMapCanvas::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsmapcanvas.o
QgsMapCanvas::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsmapcanvas.o
"QgsMapCanvas::setCanvasColor(QColor const&)", referenced from:
vtable for QgsMapCanvasin moc_qgsmapcanvas.o
"QgsMapCanvas::hasCrsTransformEnabled()", referenced from:
QgsMapCanvas::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsmapcanvas.o
"QgsMapLayerRegistry::addMapLayer(QgsMapLayer*, bool)", referenced from:
_main in main.o
"QgsMapCanvas::freeze(bool)", referenced from:
_main in main.o
"QgsVectorLayer::setRenderer(QgsRenderer*)", referenced from:
_main in main.o
"QgsMapCanvas::layerStateChange()", referenced from:
QgsMapCanvas::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsmapcanvas.o
"QgsMapLayer::subLayers()", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsMapLayer::isValid()", referenced from:
_main in main.o
"QgsMapCanvas::resizeEvent(QResizeEvent*)", referenced from:
vtable for QgsMapCanvasin moc_qgsmapcanvas.o
"QgsMapLayer::extent() const", referenced from:
_main in main.o
"QgsVectorLayer::hasCompatibleSymbology(QgsMapLayer const&) const",  
referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsMapCanvas::setLayerSet(QList<QgsMapCanvasLayer>&)", referenced from:
_main in main.o
"QgsMapLayer::connectNotify(char const*)", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsVectorLayer::isEditable() const", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsMapCanvas::mouseDoubleClickEvent(QMouseEvent*)", referenced from:
vtable for QgsMapCanvasin moc_qgsmapcanvas.o
"QgsMapCanvas::QgsMapCanvas(QWidget*, char const*)", referenced from:
_main in main.o
"QgsVectorLayer::readXml(QDomNode&)", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsMapCanvas::wheelEvent(QWheelEvent*)", referenced from:
vtable for QgsMapCanvasin moc_qgsmapcanvas.o
"QgsVectorLayer::updateExtents()", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsMapLayer::invalidTransformInput()", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsVectorLayer::isModified() const", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsMapCanvas::canvasColor() const", referenced from:
vtable for QgsMapCanvasin moc_qgsmapcanvas.o
"QgsMapCanvas::~QgsMapCanvas()", referenced from:
vtable for QgsMapCanvasin moc_qgsmapcanvas.o
"QgsApplication::QgsApplication(int&, char**, bool)", referenced from:
_main in main.o
"QgsMapCanvas::writeProject(QDomDocument&)", referenced from:
QgsMapCanvas::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsmapcanvas.o
"QgsVectorLayer::readSymbology(QDomNode const&, QString&)", referenced  
from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsMapCanvas::showError(QgsMapLayer*)", referenced from:
QgsMapCanvas::qt_metacall(QMetaObject::Call, int, void**)in  
moc_qgsmapcanvas.o
"QgsMapLayer::setSubLayerVisibility(QString, bool)", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsMapCanvas::~QgsMapCanvas()", referenced from:
vtable for QgsMapCanvasin moc_qgsmapcanvas.o
"QgsMapLayer::qt_metacast(char const*)", referenced from:
QgsVectorLayer::qt_metacast(char const*)in moc_qgsvectorlayer.o
"QgsMapLayer::lastErrorTitle()", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsMapLayer::saveDefaultStyle(bool&)", referenced from:
vtable for QgsVectorLayerin moc_qgsvectorlayer.o
"QgsVectorLayer::QgsVectorLayer(QString, QString, QString, bool)",  
referenced from:
_main in main.o
"QgsVectorLayer::geometryType() const", referenced from:
_main in main.o
"typeinfo for QgsMapLayer", referenced from:
typeinfo for QgsVectorLayerin moc_qgsvectorlayer.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
make[1]: *** [qgis_test.app/Contents/MacOS/qgis_test] Error 1
make: *** [debug] Error 2
make[1]: Leaving directory `/Users/speiserf/workspace/qgis_test'
make: Leaving directory `/Users/speiserf/workspace/qgis_test'
Exited with code 2.
Error while building project qgis_test
When executing build step 'Make'


Speiser Ferenc
ferenc.speiser at gmail.com

University of Pannonia
+36 88 624888

Speiser Ferenc
ferenc.speiser at gmail.com

University of Pannonia
+36 88 624888

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20090422/f698f419/attachment-0001.html


More information about the Qgis-developer mailing list