I am a 15 year veteran of Java making my first entry in to C++ applications. I have a specific need to develop a desktop application that produces graphics type output as well as displaying embedded maps. It looks like Qt and QGIS API are exactly what I need to get this going.

I have been playing around with Qt Creator and generated several of the tutorials without too much problems. Now I am trying my first Qt project that incorporates the QGIS API. I am really stuck. I can't figure out where the libraries are that contains the QGIS modules. I think I have an idea how to configure the Qt project if I could find QGIS. I found all the .h files but some of what I need just aren't there.

There are some good examples of code that shows how to code with QGIS classes. But I can't find anything that explains how to set the project up. Could someone please help guide me through setting up a project in Qt Creator that will allow me to incorporate the QGIS modules? I have been searching everywhere. Google can be a strange beast. Sometimes you find what you need on the first search. Other times it just never happens.

1 Answer 1


Check Tim's blog: Using QtCreator with QGIS and in QGIS' source you'll find src/plugins/plugin_builder.py

  • I tried Tim's blog. The instructions he provides are for Linux. They don't work for Windows. Commented Jul 15, 2012 at 12:33
  • 1
    What doesn't work there? I'd except that the generated cmake stuff for a new plugin works just like the rest of the (core) plugins. Did you build QGIS with QtCreator on Windows? Because the usual C++ QGIS libraries don't work with MinGW and require MSVC 2008.
    – jef
    Commented Jul 16, 2012 at 0:30
  • I have successfully built QGis on windows using VS 2010 Express. The generated QGis application itself works great. Now I am trying to integrate the QGis API in a Qt Creator project. I got the libraries in and get a good compile. But when I try to run the test ap it fails because it can't find any of the objects in the DLLs. It appears I need a "xxx.a" file to add to the project so it knows what DLLs to include. I don't have one in my QGis installation. How do I create this file? Commented Jul 19, 2012 at 15:49
  • 1
    AFAIK MinGW and VS C++ ABI are incompatible. You can't use C++ stuff from VS with MinGW. So either use VS for your plugin or build QGIS with MinGW.
    – jef
    Commented Jul 19, 2012 at 21:38
  • 1
    Either use MSVC 9/2008 with the stuff from osgeo4w (Qt, Python...; See qgis.org/api/INSTALL.html#toc14). That works even without building QGIS yourself.But anything else is mostly unknown territory, that you need to explore yourself.
    – jef
    Commented Sep 28, 2012 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.