[Qgis-developer] Help with Tutorial and Eclipse

Tim Sutton lists at linfiniti.com
Sun Jun 21 12:19:15 EDT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Matthew

I'm not familiar with eclipse as a C++ IDE but I  wonder if you have
declared the compiler constants -DCORE_EXPORT , -DGUI_EXPORT and
- -DPYTHON_EXPORT. It should be fine to declare them as empty vars if you
are under Linux. This is just a shot in the dark since as I mentioned
I've never tried to build under eclipse.

Regards

Tim

Matthew Denno wrote:
> Hello List,
> 
> I am wondering if someone can help me get the C++ tutorials to compile using
> Eclipse?
> 
> Here is my set up:
> - Ubuntu 9.04
> - QGIS version 1.0.2 standard install from the repositories
> - QGIS version 1.2.0 compiled and installed to /usr/local
> - Eclipse Ganymede with CDT and Qt Integration
> 
> So what I have done is:
> 1) Create a new Qt GUI Project, GUI Type: QMainWindow (this compiles and
> runs but doesn't do anything)
> 2) Add /usr/include/qgis to the project includes
> 3) Add the following to the .pro file:
>        INCLUDEPATH += /usr/include/qgis
>        QT += core gui sql xml svg opengl qt3support
> 4) Copy and paste the tutorial code from http://blog.qgis.org/node/10 to the
> automatically generated main.cpp file.
> 
> I have also tried to reference the QGIS version 1.2.0 that was compiled
> locally, but no luck.
> 
> When I try to compile the project it looks like the QGIS classes are not
> recognized and I get the errors below.  It looks like it is finding the *.h
> files.  I suspect that it is a problem with my *.pro file.
> 
> If someone could help me out it would be greatly appreciated, even just a
> point in the right direction.
> 
> 
> ----ERRORS-------------
> make debug
> make -f Makefile.Debug
> make[1]: Entering directory `/home/matt/workspace/QGIS_Test2'
> /usr/bin/uic-qt4 qgis_test2.ui -o ui_qgis_test2.h
> g++ -c -pipe -g -Wall -W -D_REENTRANT -DQT_SVG_LIB -DQT_QT3SUPPORT_LIB
> -DQT3_SUPPORT -DQT_SQL_LIB -DQT_XML_LIB -DQT_OPENGL_LIB -DQT_GUI_LIB
> -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I.
> -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui
> -I/usr/include/qt4/QtOpenGL -I/usr/include/qt4/QtXml
> -I/usr/include/qt4/QtSql -I/usr/include/qt4/Qt3Support
> -I/usr/include/qt4/QtSvg -I/usr/include/qt4 -I/usr/include/qgis
> -I/usr/X11R6/include -Idebug -I. -o debug/main.o main.cpp
> In file included from main.cpp:6:
> /usr/include/qgis/qgsapplication.h:25: error: function definition does not
> declare parameters
> In file included from main.cpp:7:
> /usr/include/qgis/qgsproviderregistry.h:39: error: function definition does
> not declare parameters
> In file included from /usr/include/qgis/qgsrenderer.h:29,
>                  from /usr/include/qgis/qgssinglesymbolrenderer.h:22,
>                  from main.cpp:8:
> /usr/include/qgis/qgis.h:26: error: function definition does not declare
> parameters
> In file included from /usr/include/qgis/qgssinglesymbolrenderer.h:22,
>                  from main.cpp:8:
> /usr/include/qgis/qgsrenderer.h:39: error: function definition does not
> declare parameters
> In file included from main.cpp:8:
> /usr/include/qgis/qgssinglesymbolrenderer.h:26: error: function definition
> does not declare parameters
> /usr/include/qgis/qgssinglesymbolrenderer.h:68: error:
> ‘QgsSingleSymbolRenderer’ has not been declared
> /usr/include/qgis/qgssinglesymbolrenderer.h:68: error: non-member function
> ‘const QgsSymbol* symbol()’ cannot have cv-qualifier
> /usr/include/qgis/qgssinglesymbolrenderer.h: In function ‘const QgsSymbol*
> symbol()’:
> /usr/include/qgis/qgssinglesymbolrenderer.h:70: error: ‘mSymbol’ was not
> declared in this scope
> /usr/include/qgis/qgssinglesymbolrenderer.h: At global scope:
> /usr/include/qgis/qgssinglesymbolrenderer.h:73: error:
> ‘QgsSingleSymbolRenderer’ has not been declared
> /usr/include/qgis/qgssinglesymbolrenderer.h:73: error: non-member function
> ‘bool needsAttributes()’ cannot have cv-qualifier
> In file included from main.cpp:9:
> /usr/include/qgis/qgsmaplayerregistry.h:35: error: function definition does
> not declare parameters
> In file included from /usr/include/qgis/qgsrectangle.h:26,
>                  from /usr/include/qgis/qgsmaplayer.h:27,
>                  from /usr/include/qgis/qgsvectorlayer.h:28,
>                  from main.cpp:10:
> /usr/include/qgis/qgspoint.h:30: error: function definition does not declare
> parameters
> /usr/include/qgis/qgspoint.h:138: error: expected ‘,’ or ‘...’ before ‘&’
> token
> /usr/include/qgis/qgspoint.h:138: error: ISO C++ forbids declaration of
> ‘QgsPoint’ with no type
> /usr/include/qgis/qgspoint.h:138: error: ‘bool operator==(int)’ must have an
> argument of class or enumerated type
> /usr/include/qgis/qgspoint.h:146: error: expected ‘,’ or ‘...’ before ‘&’
> token
> /usr/include/qgis/qgspoint.h:146: error: ISO C++ forbids declaration of
> ‘QgsPoint’ with no type
> /usr/include/qgis/qgspoint.h: In function ‘std::ostream&
> operator<<(std::ostream&, int)’:
> /usr/include/qgis/qgspoint.h:149: error: ‘p’ was not declared in this scope
> /usr/include/qgis/qgspoint.h: At global scope:
> /usr/include/qgis/qgspoint.h:146: warning: unused parameter ‘QgsPoint’
> In file included from /usr/include/qgis/qgsmaplayer.h:27,
>                  from /usr/include/qgis/qgsvectorlayer.h:28,
>                  from main.cpp:10:
> /usr/include/qgis/qgsrectangle.h:35: error: function definition does not
> declare parameters
> /usr/include/qgis/qgsrectangle.h:134: error: expected initializer before
> ‘::’ token
> /usr/include/qgis/qgsrectangle.h:138: error: ‘QgsRectangle’ has not been
> declared
> /usr/include/qgis/qgsrectangle.h: In function ‘void setXMinimum(double)’:
> /usr/include/qgis/qgsrectangle.h:140: error: ‘xmin’ was not declared in this
> scope
> /usr/include/qgis/qgsrectangle.h: At global scope:
> /usr/include/qgis/qgsrectangle.h:143: error: ‘QgsRectangle’ has not been
> declared
> /usr/include/qgis/qgsrectangle.h: In function ‘void setXMaximum(double)’:
> /usr/include/qgis/qgsrectangle.h:145: error: ‘xmax’ was not declared in this
> scope
> /usr/include/qgis/qgsrectangle.h: At global scope:
> /usr/include/qgis/qgsrectangle.h:148: error: ‘QgsRectangle’ has not been
> declared
> /usr/include/qgis/qgsrectangle.h: In function ‘void setYMinimum(double)’:
> /usr/include/qgis/qgsrectangle.h:150: error: ‘ymin’ was not declared in this
> scope
> /usr/include/qgis/qgsrectangle.h: At global scope:
> /usr/include/qgis/qgsrectangle.h:153: error: ‘QgsRectangle’ has not been
> declared
> /usr/include/qgis/qgsrectangle.h: In function ‘void setYMaximum(double)’:
> /usr/include/qgis/qgsrectangle.h:155: error: ‘ymax’ was not declared in this
> scope
> /usr/include/qgis/qgsrectangle.h: At global scope:
> /usr/include/qgis/qgsrectangle.h:158: error: ‘QgsRectangle’ has not been
> declared
> /usr/include/qgis/qgsrectangle.h:158: error: non-member function ‘double
> xMaximum()’ cannot have cv-qualifier
> /usr/include/qgis/qgsrectangle.h: In function ‘double xMaximum()’:
> /usr/include/qgis/qgsrectangle.h:160: error: ‘xmax’ was not declared in this
> scope
> /usr/include/qgis/qgsrectangle.h: At global scope:
> /usr/include/qgis/qgsrectangle.h:163: error: ‘QgsRectangle’ has not been
> declared
> /usr/include/qgis/qgsrectangle.h:163: error: non-member function ‘double
> xMinimum()’ cannot have cv-qualifier
> /usr/include/qgis/qgsrectangle.h: In function ‘double xMinimum()’:
> /usr/include/qgis/qgsrectangle.h:165: error: ‘xmin’ was not declared in this
> scope
> /usr/include/qgis/qgsrectangle.h: At global scope:
> /usr/include/qgis/qgsrectangle.h:168: error: ‘QgsRectangle’ has not been
> declared
> /usr/include/qgis/qgsrectangle.h:168: error: non-member function ‘double
> yMaximum()’ cannot have cv-qualifier
> /usr/include/qgis/qgsrectangle.h: In function ‘double yMaximum()’:
> /usr/include/qgis/qgsrectangle.h:170: error: ‘ymax’ was not declared in this
> scope
> /usr/include/qgis/qgsrectangle.h: At global scope:
> /usr/include/qgis/qgsrectangle.h:173: error: ‘QgsRectangle’ has not been
> declared
> /usr/include/qgis/qgsrectangle.h:173: error: non-member function ‘double
> yMinimum()’ cannot have cv-qualifier
> /usr/include/qgis/qgsrectangle.h: In function ‘double yMinimum()’:
> /usr/include/qgis/qgsrectangle.h:175: error: ‘ymin’ was not declared in this
> scope
> /usr/include/qgis/qgsrectangle.h: At global scope:
> /usr/include/qgis/qgsrectangle.h:178: error: ‘QgsRectangle’ has not been
> declared
> /usr/include/qgis/qgsrectangle.h:178: error: non-member function ‘double
> width()’ cannot have cv-qualifier
> /usr/include/qgis/qgsrectangle.h: In function ‘double width()’:
> /usr/include/qgis/qgsrectangle.h:180: error: ‘xmax’ was not declared in this
> scope
> /usr/include/qgis/qgsrectangle.h:180: error: ‘xmin’ was not declared in this
> scope
> /usr/include/qgis/qgsrectangle.h: At global scope:
> /usr/include/qgis/qgsrectangle.h:183: error: ‘QgsRectangle’ has not been
> declared
> /usr/include/qgis/qgsrectangle.h:183: error: non-member function ‘double
> height()’ cannot have cv-qualifier
> /usr/include/qgis/qgsrectangle.h: In function ‘double height()’:
> /usr/include/qgis/qgsrectangle.h:185: error: ‘ymax’ was not declared in this
> scope
> /usr/include/qgis/qgsrectangle.h:185: error: ‘ymin’ was not declared in this
> scope
> /usr/include/qgis/qgsrectangle.h: At global scope:
> /usr/include/qgis/qgsrectangle.h:188: error: ‘QgsPoint’ does not name a type
> /usr/include/qgis/qgsrectangle.h:192: error: expected ‘,’ or ‘...’ before
> ‘&’ token
> /usr/include/qgis/qgsrectangle.h:192: error: ISO C++ forbids declaration of
> ‘QgsRectangle’ with no type
> /usr/include/qgis/qgsrectangle.h: In function ‘std::ostream&
> operator<<(std::ostream&, int)’:
> /usr/include/qgis/qgsrectangle.h:192: error: redefinition of ‘std::ostream&
> operator<<(std::ostream&, int)’
> /usr/include/qgis/qgspoint.h:146: error: ‘std::ostream&
> operator<<(std::ostream&, int)’ previously defined here
> /usr/include/qgis/qgsrectangle.h:194: error: ‘r’ was not declared in this
> scope
> /usr/include/qgis/qgsrectangle.h: At global scope:
> /usr/include/qgis/qgsrectangle.h:192: warning: unused parameter
> ‘QgsRectangle’
> In file included from /usr/include/qgis/qgsvectorlayer.h:28,
>                  from main.cpp:10:
> /usr/include/qgis/qgsmaplayer.h:41: error: function definition does not
> declare parameters
> In file included from /usr/include/qgis/qgsvectorlayer.h:29,
>                  from main.cpp:10:
> /usr/include/qgis/qgsfeature.h:49: error: function definition does not
> declare parameters
> In file included from /usr/include/qgis/qgsvectorlayer.h:30,
>                  from main.cpp:10:
> /usr/include/qgis/qgssnapper.h:32: error: function definition does not
> declare parameters
> /usr/include/qgis/qgssnapper.h:58: error: function definition does not
> declare parameters
> In file included from /usr/include/qgis/qgsvectorlayer.h:32,
>                  from main.cpp:10:
> /usr/include/qgis/qgsfield.h:29: error: function definition does not declare
> parameters
> /usr/include/qgis/qgsfield.h:147: error: ‘QgsField’ was not declared in this
> scope
> /usr/include/qgis/qgsfield.h:147: error: template argument 2 is invalid
> /usr/include/qgis/qgsfield.h:147: error: invalid type in declaration before
> ‘;’ token
> In file included from main.cpp:10:
> /usr/include/qgis/qgsvectorlayer.h:57: error: function definition does not
> declare parameters
> In file included from main.cpp:11:
> /usr/include/qgis/qgsmapcanvas.h:62: error: function definition does not
> declare parameters
> /usr/include/qgis/qgsmapcanvas.h:93: error: function definition does not
> declare parameters
> main.cpp: In function ‘int main(int, char**)’:
> main.cpp:22: error: ‘QgsApplication’ was not declared in this scope
> main.cpp:22: error: expected `;' before ‘app’
> main.cpp:30: error: ‘QgsProviderRegistry’ has not been declared
> main.cpp:33: error: invalid use of incomplete type ‘struct QgsVectorLayer’
> /usr/include/qgis/qgsrenderer.h:22: error: forward declaration of ‘struct
> QgsVectorLayer’
> main.cpp:34: error: ‘QgsSingleSymbolRenderer’ was not declared in this scope
> main.cpp:34: error: ‘mypRenderer’ was not declared in this scope
> main.cpp:34: error: expected type-specifier before ‘QgsSingleSymbolRenderer’
> main.cpp:34: error: expected `;' before ‘QgsSingleSymbolRenderer’
> main.cpp:35: error: ‘QgsMapCanvasLayer’ was not declared in this scope
> main.cpp:35: error: template argument 1 is invalid
> main.cpp:35: error: invalid type in declaration before ‘;’ token
> main.cpp:37: error: invalid use of incomplete type ‘struct QgsVectorLayer’
> /usr/include/qgis/qgsrenderer.h:22: error: forward declaration of ‘struct
> QgsVectorLayer’
> main.cpp:38: error: invalid use of incomplete type ‘struct QgsVectorLayer’
> /usr/include/qgis/qgsrenderer.h:22: error: forward declaration of ‘struct
> QgsVectorLayer’
> main.cpp:48: error: ‘QgsMapLayerRegistry’ has not been declared
> main.cpp:50: error: request for member ‘append’ in ‘myLayerSet’, which is of
> non-class type ‘int’
> main.cpp:52: error: ‘QgsMapCanvas’ was not declared in this scope
> main.cpp:52: error: ‘mypMapCanvas’ was not declared in this scope
> main.cpp:52: error: expected type-specifier before ‘QgsMapCanvas’
> main.cpp:52: error: expected `;' before ‘QgsMapCanvas’
> main.cpp:53: error: invalid use of incomplete type ‘struct QgsVectorLayer’
> /usr/include/qgis/qgsrenderer.h:22: error: forward declaration of ‘struct
> QgsVectorLayer’
> main.cpp:63: error: ‘app’ was not declared in this scope
> main.cpp: At global scope:
> main.cpp:19: warning: unused parameter ‘argc’
> main.cpp:19: warning: unused parameter ‘argv’
> make[1]: *** [debug/main.o] Error 1
> make: *** [debug] Error 2
> make[1]: Leaving directory `/home/matt/workspace/QGIS_Test2'
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer


- --

Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
==============================================
Please do not email me off-list with technical
support questions. Using the lists will gain
more exposure for your issues and the knowledge
surrounding your issue will be shared with all.

Visit http://linfiniti.com to find out about:
 * QGIS programming and support services
 * Mapserver and PostGIS based hosting plans
 * FOSS Consulting Services
Skype: timlinux
Irc: timlinux on #qgis at freenode.net
==============================================

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAko+XXIACgkQqk07qZdiYjdWEQCfQ7T9uOkK86WmYAQ+e0yett6Q
losAoL45e+VMUvlxVDOAKYW8VhkVOqSm
=4Ifu
-----END PGP SIGNATURE-----


More information about the Qgis-developer mailing list