[Marble-devel] how to use MarbleWidget with Qt c++ on WIndows ans visual studio

Bernhard Beschow bbeschow at cs.tu-berlin.de
Tue Aug 2 19:28:47 UTC 2011


On Dienstag, 2. August 2011 15:45:59 M.Ozeau wrote:
> Hi and sorry for my poor English.

Hi Cordialy,

> I want to use the MarbleWidget on Visual C++. So i try to compile Marble
> with visual Studio, but it fail (i made a post about this :
> http://forum.kde.org/viewtopic.php?f=21&t=96213&sid=710f72525a7946c67f3b8c3158ef4529)
> but i finally success to compile Marble with the MinGW command.
> 
> I want to do this tutorial :
> 
> http://techbase.kde.org/Projects/Marble/MarbleCPlusPlus
> 
> I create a new project, include all the include file i found in c:\programs
> files\marble\include
> 
> I include marblewidget.h and use the namespace like in the tutorial :
> 
> #include <QtGui>
> #include <QtGui/qapplication.h>
> #include <QtGui/qpushButton.h>
> 
> #include <marbleInclude/MarbleWidget.h>
> 
> using namespace Marble;
> 
> int main(int argc, char *argv[])
> {
> 	QApplication app(argc, argv);
> 
> 	// Create a Marble QWidget without a parent
>     MarbleWidget *mapWidget = new MarbleWidget();
> 
> 
>     // Load the OpenStreetMap map
>     mapWidget->setMapThemeId("earth/openstreetmap/openstreetmap.dgml");
> 
>     mapWidget->show();
> 
> 	return app.exec();
> }
> 
> 
> But I still got some error :
> 
> error LNK2019: unresolved external symbol "__declspec(dllimport) public:
> void __thiscall Marble::MarbleWidget::
> setMapThemeId(class QString const &)" (__imp_?setMapThemeId at MarbleWidget
> @Marble@@QAEXABVQString@@@Z) referenced in function _main
> 
> error LNK2019: unresolved external symbol "__declspec(dllimport) public:
> __thiscall Marble::MarbleWidget::MarbleWidget(class QWidget *)"
> (__imp_??0MarbleWidget at Marble@@QAE at PAVQWidget@@@Z) referenced in function
> _main    Main.obj
> 
> 
> I can use the MarbleWidget in QtDesigner
> 
> Any Idea ?

You cannot mix the GCC-based mingw with Visual Studio's C++ compiler (cl.exe) due to different ABIs.

I can see at least two options if you want to use Visual Studio:
1) compile Marble yourself following http://techbase.kde.org/Projects/Marble/WindowsCompiling
2) download one of our Windows installers from http://edu.kde.org/marble/download.php (which reminds me to create the Marble-1.2 installer for Windows ;) )

Greetings,
Bernhard


More information about the Marble-devel mailing list