Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I have built QGIS using Visual Studio 2008. I would now like to start using the QGIS API for Windows Development. Of course I have Qt installed on Studio I hope correctly. I am new to Visual Studio and can't find any "How To" guides on setting up a QGIS/Qt project. I am trying to go with the tutorial "Write a simple mapping application using the new QGIS Canvas API". I have created a new project called QGisSample and added the code to main.cpp. When I attempt to build the project I get all sorts of errors. This has to be a configuration problem setting up the project. But I just do not know where to start. There are, a few of, the errors:

    1>Compiling...
    1>main.cpp
    1>D:\QGIS.1.8.0-2\Source\src\core\qgis.h(31) : error C2470: 'QGis' : looks like a function definition, but there is no parameter list; skipping apparent body
    1>D:\QGIS.1.8.0-2\Source\src\core\qgis.h(160) : error C2146: syntax error : missing ';' before identifier 'GEOPROJ4'
    1>D:\QGIS.1.8.0-2\Source\src\core\qgis.h(160) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>D:\QGIS.1.8.0-2\Source\src\core\qgis.h(168) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>D:\QGIS.1.8.0-2\Source\src\core\qgis.h(168) : error C2146: syntax error : missing ';' before identifier 'GEO_EPSG_CRS_AUTHID'
    1>D:\QGIS.1.8.0-2\Source\src\core\qgis.h(168) : error C2371: 'QString' : redefinition; different basic types
    1>        D:\QGIS.1.8.0-2\Source\src\core\qgis.h(160) : see declaration of 'QString'
    1>D:\QGIS.1.8.0-2\Source\src\core\qgis.h(168) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>D:\QGIS.1.8.0-2\Source\src\core\qgis.h(168) : error C2440: 'initializing' : cannot convert from 'const char [10]' to 'int'
    1>        There is no context in which this conversion is possible
    1>D:\QGIS.1.8.0-2\Source\src\core\qgsapplication.h(30) : error C2470: 'QgsApplication' : looks like a function definition, but there is no parameter list; skipping apparent body
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C2146: syntax error : missing ';' before identifier 'tr'
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C2433: 'QFile::QString' : 'inline' not permitted on data declarations
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : warning C4183: 'tr': missing return type; assumed to be a member function returning 'int'
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C2146: syntax error : missing ';' before identifier 'trUtf8'
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C2433: 'QFile::QString' : 'inline' not permitted on data declarations
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : warning C4183: 'trUtf8': missing return type; assumed to be a member function returning 'int'
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C2146: syntax error : missing ';' before identifier 'tr'
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C2433: 'QFile::QString' : 'inline' not permitted on data declarations
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : warning C4183: 'tr': missing return type; assumed to be a member function returning 'int'
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C2146: syntax error : missing ';' before identifier 'trUtf8'
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C2433: 'QFile::QString' : 'inline' not permitted on data declarations
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
    1>d:\qt.os.4.8.2\include\qtcore\../../src/corelib/io/qfile.h(68) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

There is plenty more where that came from. I set this project up as a Qt Application. I also added the library where the core .h files are and the QGIS lib files that were generated when I built QGIS.

I'm just fumbling around with this trying to Google the various problems. For now it appears I have left something out that is fundamental to the QGIS project.

Any suggestions are gladly appreciated.

share|improve this question
    
have you been able to build qgis from source in windows as per qgis.org/api/INSTALL.html#toc13 .. in my opinion, Linux makes life much easier for qgis building.. –  vinayan Sep 2 '12 at 12:13
    
I am sure it does. But sometimes we do not have the option to choose. Those of us in that position far too many times get the "advice" of using Linux instead of getting real help. I have built and installed QGis as per the instructions. But when I try to build the first application from "Tutorial 1: Write a simple mapping application ..." and am getting all sorts of errors. QString is a Qt object, not QGis. It appears it is not finding QString even though the correct libraries are included. Evidently there is a specific configuration for a Qt/QGis project in MVS. Does anyone know it? –  user1078284 Sep 3 '12 at 14:38
    
Did you look at the scripts Quantum-GIS/ms-windows/osgeo4w/package{-nightly}.cmd ? –  Matthias Kuhn Apr 21 '13 at 20:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.