This forum has been archived. All content is frozen. Please use KDE Discuss instead.

link error own code against koffice

Tags: None
(comma "," separated)
xyfix
Registered Member
Posts
110
Karma
0

link error own code against koffice

Wed Mar 10, 2010 9:38 am
I've integrated kword as a kpart in my application but I found out that a few options like print, print preview, save ... aren't available when kword is used as a kpart. These options reside in the KoMainWindow class, since my MainWindow is derived from KParts::MainWindow and not KoMainWindow I didn't have access to the functions, so I created a new class with these functions that one can use when kword is used a kpart. In the Save function a KoFileDialog is used (for the save location and file type) but a strange error occures when linking occures

Linking CXX shared library ../../lib/libkwordprivate.so
CMakeFiles/kwordprivate.dir/KWKoMainWindowActions.o: In function `KWKoMainWindowActions::saveDocument(bool, bool)':
/home/user/koffice-2.1/src/kword/part/KWKoMainWindowActions.cpp:169: undefined reference to `KoFileDialog::KoFileDialog(QString const&, QWidget*)'
/home/user/koffice-2.1/src/kword/part/KWKoMainWindowActions.cpp:178: undefined reference to `KoFileDialog::setSpecialMimeFilter(QStringList&, QString const&, int, QString const&, int)'
/home/user/koffice-2.1/src/kword/part/KWKoMainWindowActions.cpp:195: undefined reference to `KoFileDialog::specialEntrySelected()'
collect2: ld returned 1 exit status
make[2]: *** [lib/libkwordprivate.so.6.0.0] Error 1
make[1]: *** [kword/part/CMakeFiles/kwordprivate.dir/all] Error 2


the code where this is used is ( straight from KoMainWindow ):
Code: Select all
if (m_view->kwdocument()->url().isEmpty() || saveas) {
   // if you're just File/Save As'ing to change filter options you
   // don't want to be reminded about overwriting files etc.
   bool justChangingFilterOptions = false;

   KoFileDialog *dialog = new KoFileDialog((isExporting() && !m_lastExportUrl.isEmpty()) ? m_lastExportUrl.url() : suggestedURL.url(), m_view)


the full code is here http://pastebin.com/VLYdQxkH . Please tell me where to upload the files because I altered KWView.cpp in order to get this working.

When running make for koffice with VERBOSE=1 I get:
Linking CXX shared library ../../lib/libkwordprivate.so
cd /home/user/koffice-2.1/src/kword/part && /usr/bin/cmake -E cmake_link_script CMakeFiles/kwordprivate.dir/link.txt --verbose=1
/usr/bin/c++ -fPIC -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -fno-check-new -fno-common -Woverloaded-virtual -fno-threadsafe-statics -fvisibility=hidden -fvisibility-inlines-hidden -O2 -g -DNDEBUG -DQT_NO_DEBUG -Wl,--enable-new-dtags -Wl,--fatal-warnings -Wl,--no-undefined -lc -shared -Wl,-soname,libkwordprivate.so.6 -o ../../lib/libkwordprivate.so.6.0.0 CMakeFiles/kwordprivate.dir/kwordprivate_automoc.o CMakeFiles/kwordprivate.dir/KWFactory.o CMakeFiles/kwordprivate.dir/KWord.o CMakeFiles/kwordprivate.dir/KWApplicationConfig.o CMakeFiles/kwordprivate.dir/KWCanvas.o CMakeFiles/kwordprivate.dir/KWDocument.o CMakeFiles/kwordprivate.dir/KWGui.o CMakeFiles/kwordprivate.dir/KWKoMainWindowActions.o CMakeFiles/kwordprivate.dir/KWView.o CMakeFiles/kwordprivate.dir/KWPage.o CMakeFiles/kwordprivate.dir/KWPageManager.o CMakeFiles/kwordprivate.dir/KWPageStyle.o CMakeFiles/kwordprivate.dir/KWPageTextInfo.o CMakeFiles/kwordprivate.dir/KWViewMode.o CMakeFiles/kwordprivate.dir/KWViewModeNormal.o CMakeFiles/kwordprivate.dir/KWViewModePreview.o CMakeFiles/kwordprivate.dir/KWStatusBar.o CMakeFiles/kwordprivate.dir/KWOdfLoader.o CMakeFiles/kwordprivate.dir/KWOdfWriter.o CMakeFiles/kwordprivate.dir/KWOdfSharedLoadingData.o CMakeFiles/kwordprivate.dir/KWDLoader.o CMakeFiles/kwordprivate.dir/frames/KWTextDocumentLayout.o CMakeFiles/kwordprivate.dir/frames/KWFrameLayout.o CMakeFiles/kwordprivate.dir/frames/KWFrame.o CMakeFiles/kwordprivate.dir/frames/KWFrameSet.o CMakeFiles/kwordprivate.dir/frames/KWTextFrame.o CMakeFiles/kwordprivate.dir/frames/KWTextFrameSet.o CMakeFiles/kwordprivate.dir/frames/KWCopyShape.o CMakeFiles/kwordprivate.dir/frames/KWAnchorStrategy.o CMakeFiles/kwordprivate.dir/frames/KWOutlineShape.o CMakeFiles/kwordprivate.dir/dialogs/KWFrameConnectSelector.o CMakeFiles/kwordprivate.dir/dialogs/KWFrameGeometry.o CMakeFiles/kwordprivate.dir/dialogs/KWFrameRunaroundProperties.o CMakeFiles/kwordprivate.dir/dialogs/KWGeneralFrameProperties.o CMakeFiles/kwordprivate.dir/dialogs/KWFrameDialog.o CMakeFiles/kwordprivate.dir/dialogs/KWShapeConfigFactory.o CMakeFiles/kwordprivate.dir/dialogs/KWDocumentColumns.o CMakeFiles/kwordprivate.dir/dialogs/KWStartupWidget.o CMakeFiles/kwordprivate.dir/dialogs/KWPageSettingsDialog.o CMakeFiles/kwordprivate.dir/dialogs/KWStatistics.o CMakeFiles/kwordprivate.dir/dialogs/KWStatisticsDialog.o CMakeFiles/kwordprivate.dir/dialogs/KWPrintingDialog.o CMakeFiles/kwordprivate.dir/dialogs/KWCreateBookmarkDialog.o CMakeFiles/kwordprivate.dir/dialogs/KWSelectBookmarkDialog.o CMakeFiles/kwordprivate.dir/dockers/KWStatisticsDocker.o CMakeFiles/kwordprivate.dir/commands/KWPagePropertiesCommand.o CMakeFiles/kwordprivate.dir/commands/KWPageInsertCommand.o CMakeFiles/kwordprivate.dir/commands/KWPageRemoveCommand.o CMakeFiles/kwordprivate.dir/commands/KWFrameDeleteCommand.o CMakeFiles/kwordprivate.dir/commands/KWFrameCreateCommand.o CMakeFiles/kwordprivate.dir/commands/KWCreateOutlineCommand.o -L/home/user/koffice-2.1/src/lib ../../lib/libkomain.so.6.0.0 ../../lib/libkoaction.so.6.0.0 ../../lib/libkowidgets.so.6.0.0 ../../lib/libkotext.so.6.0.0 ../../lib/libflake.so.6.0.0 ../../lib/libpigmentcms.so.6.0.0 ../../lib/libkoplugin.so.6.0.0 -llcms -lImath -lIlmImf -lIex -lHalf -lIlmThread ../../lib/libkoodf.so.6.0.0 ../../lib/libkostore.so.6.0.0 ../../lib/libkobase.so.6.0.0 /usr/lib/libkparts.so.4.3.0 /usr/lib/libkio.so.5.3.0 /usr/lib/libkdeui.so.5.3.0 -lQtSvg /usr/lib/libkdecore.so.5.3.0 -lQtDBus -lQtCore -lpthread -lQtNetwork -lQtGui -lQtXml -Wl,-rpath,/home/user/koffice-2.1/src/lib
CMakeFiles/kwordprivate.dir/KWKoMainWindowActions.o: In function `KWKoMainWindowActions::saveDocument(bool, bool)':
/home/user/koffice-2.1/src/kword/part/KWKoMainWindowActions.cpp:169: undefined reference to `KoFileDialog::KoFileDialog(QString const&, QWidget*)'
/home/user/koffice-2.1/src/kword/part/KWKoMainWindowActions.cpp:178: undefined reference to `KoFileDialog::setSpecialMimeFilter(QStringList&, QString const&, int, QString const&, int)'
/home/user/koffice-2.1/src/kword/part/KWKoMainWindowActions.cpp:195: undefined reference to `KoFileDialog::specialEntrySelected()'
collect2: ld returned 1 exit status
make[2]: *** [lib/libkwordprivate.so.6.0.0] Error 1
make[2]: Leaving directory `/home/user/koffice-2.1/src'
make[1]: *** [kword/part/CMakeFiles/kwordprivate.dir/all] Error 2
make[1]: Leaving directory `/home/user/koffice-2.1/src'
make: *** [all] Error 2


So I can see that libkomain is linked and nm -C lib/libkomain.so.6.0.0 | grep KoFileDialog gives me:
000dbaa0 r qt_meta_data_KoFileDialog
000dba60 r qt_meta_stringdata_KoFileDialog
000727c0 t KoFileDialog::qt_metacall(QMetaObject::Call, int, void**)
00072640 t KoFileDialog::qt_metacast(char const*)
000f2938 d KoFileDialog::staticMetaObject
00072720 t KoFileDialog::slotChangedfilter(int)
000729f0 t KoFileDialog::setSpecialMimeFilter(QStringList&, QString const&, int, QString const&, int)
000726a0 t KoFileDialog::specialEntrySelected()
00072830 t KoFileDialog::KoFileDialog(QString const&, QWidget*)
00072910 t KoFileDialog::KoFileDialog(QString const&, QWidget*)
00073550 t KoFileDialog::~KoFileDialog()
000735c0 t KoFileDialog::~KoFileDialog()
00072620 t KoFileDialog::metaObject() const
000f2a80 d typeinfo for KoFileDialog
000dba49 r typeinfo name for KoFileDialog
000f2960 d vtable for KoFileDialog
00073540 t non-virtual thunk to KoFileDialog::~KoFileDialog()
000735b0 t non-virtual thunk to KoFileDialog::~KoFileDialog()


so the symbols are there( however it says QString const& instead of const QString& like in the API documentation ) and when putting libs/main/CMakeFiles/komain.dir/KoFileDialog.o directly in the linking statement everything goes well. Can somebody explain this to me please ???

GNU ld (GNU Binutils; openSUSE 11.2) 2.19.51.20090527-10.26.4
c++ (SUSE Linux) 4.4.1 [gcc-4_4-branch revision 150839]
xyfix
Registered Member
Posts
110
Karma
0

Re: link error koffice

Wed Mar 10, 2010 3:13 pm
In the pastebin code you'll see that I tried to add the actions in the actionCollection of my m_view, but these actions don't get called. I can see them in the GUI but clicking on them doesn't do anything. Is this the right way to add action to the actioncollection of the m_view object?
xyfix
Registered Member
Posts
110
Karma
0
Somebody changed the subject to linking error of my own code against koffice. But this also occures when I add the code to KWView.cpp and thus without any code of mine but only kword and koffice codes.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]