[Marble-devel] Question
Bryan Greenway
rbgreenway at gmail.com
Fri Jul 23 04:31:57 CEST 2010
Hello,
I am trying to put the MarbleWidget into a Qt only application using Qt
Creator, and am having some difficulty. Here's is what I've done thus far:
1. Followed instructions for downloading and compiling Marble on
Windows. That seemed to go fine.
2. I looked at the QtMainWindow.cpp as a model for what I was putting
together. I deviated from that approach somewhat as I am creating a simple
Dialog app. On this dialog, I am trying to instantiate a ControlView (as
is done in QtMainWindow) from ControlView.cpp/.h. See dialog.cpp/.h below.
////////////////////////////////
// dialog.h
#ifndef DIALOG_H
#define DIALOG_H
#include <QDialog>
#include "ControlView.h"
namespace Ui {
class Dialog;
}
namespace Marble{
class MarbleWidget;
class Dialog : public QDialog
{
Q_OBJECT
public:
explicit Dialog(const QString& marbleDataPath,QWidget *parent = 0);
~Dialog();
ControlView* marbleControl(){return m_controlView;}
MarbleWidget* marbleWidget(){return m_controlView->marbleWidget();}
private:
Ui::Dialog *ui;
ControlView *m_controlView;
private slots:
void on_QuitPB_clicked();
};
} // namespace Marble
#endif // DIALOG_H
////////////////////////////////
// dialog.cpp
#include "dialog.h"
#include "ui_dialog.h"
using namespace Marble;
Dialog::Dialog(const QString& marbleDataPath,QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog)
{
ui->setupUi(this);
m_controlView = new ControlView(this);
setWindowTitle("MIT Lincoln Lab - COTM Tracker");
}
Dialog::~Dialog()
{
delete ui;
}
void Dialog::on_QuitPB_clicked()
{
exit(0);
}
////////////////////////////////
// main.cpp
#include <QtGui/QApplication>
#include "dialog.h"
#include "MarbleDebug.h"
#include "MarbleDirs.h"
using namespace Marble;
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QString marbleDataPath = "C:\\Program Files\\Marble 0.8.0\\data";
Dialog *mp_dialog = new Dialog(marbleDataPath);
mp_dialog->setAttribute(Qt::WA_DeleteOnClose,true);
mp_dialog->show();
return a.exec();
}
////////////////////////////////
// .pro file
#-------------------------------------------------
#
# Project created by QtCreator 2010-07-21T16:14:07
#
#-------------------------------------------------
QT += core gui
TARGET = cotm_map
TEMPLATE = app
SOURCES += main.cpp\
dialog.cpp \
ControlView.cpp
HEADERS += dialog.h \
ControlView.h
FORMS += dialog.ui
win32 {
INCLUDEPATH += C:/marble/src/lib\
C:/marble/src/lib/geodata/data\
C:/marble/src/lib/geodata\
C:/marble/src/lib/graphicsview\
C:/marble-build/src/lib\
C:/marble-build/src
LIBS += -L"c:\marble-build\src\lib\" "libmarblewidget.dll"
}
unix {
LIBS += -L/usr/local/lib \
-lmarblewidget
}
//////////////////////////////////////////////////////////////
// Compile Output
Running build steps for project cotm_map...
Configuration unchanged, skipping qmake step.
Starting: "C:/Qt/2010.04/mingw/bin/mingw32-make.exe" -w
mingw32-make: Entering directory `C:/Users/Bryan
Greenway/Documents/Qt_Projects/cotm_map-build-desktop'
C:/Qt/2010.04/mingw/bin/mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `C:/Users/Bryan
Greenway/Documents/Qt_Projects/cotm_map-build-desktop'
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE
-DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB
-DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"c:\Qt\2010.04\qt\include\QtCore"
-I"c:\Qt\2010.04\qt\include\QtGui" -I"c:\Qt\2010.04\qt\include"
-I"c:\marble\src\lib" -I"c:\marble\src\lib\geodata\data"
-I"c:\marble\src\lib\geodata" -I"c:\marble\src\lib\graphicsview"
-I"c:\marble-build\src\lib" -I"c:\marble-build\src"
-I"c:\Qt\2010.04\qt\include\ActiveQt" -I"release" -I"." -I"..\cotm_map"
-I"." -I"c:\Qt\2010.04\qt\mkspecs\win32-g++" -o release\dialog.o
..\cotm_map\dialog.cpp
g++ -enable-stdcall-fixup -Wl,-enable-auto-import
-Wl,-enable-runtime-pseudo-reloc -Wl,-s -mthreads -Wl -Wl,-subsystem,windows
-o release\cotm_map.exe release/main.o release/dialog.o
release/ControlView.o release/moc_dialog.o release/moc_ControlView.o
-L"c:\Qt\2010.04\qt\lib" -lmingw32 -lqtmain "-Lc:\marble-build\src\lib
-lmarblewidget.dll" -lQtGui4 -lQtCore4
release/ControlView.o:ControlView.cpp:(.text+0x93): undefined reference to
`_imp___ZN6Marble16MarbleControlBox19setFileViewTabShownEb'
release/ControlView.o:ControlView.cpp:(.text+0xb3): undefined reference to
`_imp___ZN6Marble16MarbleControlBox26setCurrentLocationTabShownEb'
release/ControlView.o:ControlView.cpp:(.text+0xd3): undefined reference to
`_imp___ZN6Marble16MarbleControlBox18setMapViewTabShownEb'
release/ControlView.o:ControlView.cpp:(.text+0xf3): undefined reference to
`_imp___ZN6Marble16MarbleControlBox17setLegendTabShownEb'
release/ControlView.o:ControlView.cpp:(.text+0x113): undefined reference to
`_imp___ZN6Marble16MarbleControlBox21setNavigationTabShownEb'
release/ControlView.o:ControlView.cpp:(.text+0x12c): undefined reference to
`_imp___ZN6Marble12MarbleWidget8moveDownEv'
release/ControlView.o:ControlView.cpp:(.text+0x144): undefined reference to
`_imp___ZN6Marble12MarbleWidget6moveUpEv'
release/ControlView.o:ControlView.cpp:(.text+0x15c): undefined reference to
`_imp___ZN6Marble12MarbleWidget9moveRightEv'
release/ControlView.o:ControlView.cpp:(.text+0x174): undefined reference to
`_imp___ZN6Marble12MarbleWidget8moveLeftEv'
release/ControlView.o:ControlView.cpp:(.text+0x18c): undefined reference to
`_imp___ZN6Marble12MarbleWidget7zoomOutEv'
release/ControlView.o:ControlView.cpp:(.text+0x1a4): undefined reference to
`_imp___ZN6Marble12MarbleWidget6zoomInEv'
release/ControlView.o:ControlView.cpp:(.text+0x3cc): undefined reference to
`_imp___ZN6Marble16MarbleControlBoxC1EP7QWidget'
release/ControlView.o:ControlView.cpp:(.text+0x430): undefined reference to
`_imp___ZN6Marble12MarbleWidgetC1EP7QWidget'
release/ControlView.o:ControlView.cpp:(.text+0x5a4): undefined reference to
`_imp___ZN6Marble16MarbleControlBox15addMarbleWidgetEPNS_12MarbleWidgetE'
release/ControlView.o:ControlView.cpp:(.text+0x5c3): undefined reference to
`_imp___ZN6Marble15MapThemeManagerC1EP7QObject'
release/ControlView.o:ControlView.cpp:(.text+0x5cf): undefined reference to
`_imp___ZN6Marble15MapThemeManager13mapThemeModelEv'
release/ControlView.o:ControlView.cpp:(.text+0x5df): undefined reference to
`_imp___ZN6Marble16MarbleControlBox16setMapThemeModelEP18QStandardItemModel'
release/ControlView.o:ControlView.cpp:(.text+0x5eb): undefined reference to
`_imp___ZN6Marble16MarbleControlBox18updateMapThemeViewEv'
release/ControlView.o:ControlView.cpp:(.text+0x7d8): undefined reference to
`_imp___ZN6Marble16MarbleControlBoxC1EP7QWidget'
release/ControlView.o:ControlView.cpp:(.text+0x83c): undefined reference to
`_imp___ZN6Marble12MarbleWidgetC1EP7QWidget'
release/ControlView.o:ControlView.cpp:(.text+0x9b0): undefined reference to
`_imp___ZN6Marble16MarbleControlBox15addMarbleWidgetEPNS_12MarbleWidgetE'
mingw32-make[1]: Leaving directory `C:/Users/Bryan
Greenway/Documents/Qt_Projects/cotm_map-build-desktop'
mingw32-make: Leaving directory `C:/Users/Bryan
Greenway/Documents/Qt_Projects/cotm_map-build-desktop'
release/ControlView.o:ControlView.cpp:(.text+0x9cf): undefined reference to
`_imp___ZN6Marble15MapThemeManagerC1EP7QObject'
release/ControlView.o:ControlView.cpp:(.text+0x9db): undefined reference to
`_imp___ZN6Marble15MapThemeManager13mapThemeModelEv'
release/ControlView.o:ControlView.cpp:(.text+0x9eb): undefined reference to
`_imp___ZN6Marble16MarbleControlBox16setMapThemeModelEP18QStandardItemModel'
release/ControlView.o:ControlView.cpp:(.text+0x9f7): undefined reference to
`_imp___ZN6Marble16MarbleControlBox18updateMapThemeViewEv'
collect2: ld returned 1 exit status
mingw32-make[1]: *** [release\cotm_map.exe] Error 1
mingw32-make: *** [release] Error 2
The process "C:/Qt/2010.04/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project cotm_map (target: Desktop)
When executing build step 'Make'
////////////////////////////////////////////////////////////////
My observations:
It appears to me that I'm not getting my libmarblewidget library to link.
The file: libmarblewidget.dll is definitely in the c:\marble-build\src\lib\"
directory. And the makefile has the line:
LIBS = -L"c:\Qt\2010.04\qt\lib" -lmingw32 -lqtmain
"-Lc:\marble-build\src\lib -lmarblewidget.dll" -lQtGui4 -lQtCore4
It also appears to me that I need to link in something for the
MarbleControlBox and MapThemeManager. I'm guessing that these are not part
of the MarbleWidget, so something else will need to be included.
Any help/suggestions would be greatly appreciated. I apologize for the long
email.
Thanks very much!!
Bryan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/marble-devel/attachments/20100722/e3e6908a/attachment-0001.htm
More information about the Marble-devel
mailing list