[Okular-devel] Creating new class

Jakub Zakrzewski zakrzewski.jakub at gmail.com
Thu Dec 20 10:09:50 UTC 2012


Hey guys,

few days ago I wrote that I want to implement a new feature in okular:
displaying the search results overview
using table of contents.

Now I'm playing with code and I want to make a copy of the ui/toc.cpp class
and the classes it uses:
tocmodel.cpp

What I did is:
I copied the ui/toc.(h|cpp) and ui/tocmodel.(h|cpp) files so I have
tocsearch.h, tocsearch.cpp, tocsearchmodel.h,
tocsearchmodel.cpp.

I also changed the classes names and references so they have 'Search' in
their names, e.g.:
TOCSearchItem, TOCSearchModelPrivate

In the CMakeLists.txt I added
   ui/tocsearch.cpp
   ui/tocsearchmodel.cpp
where toc.cpp is.

I also added necessary #include directives in the files where I want to use
new classes.

I created the tocsearch.moc and tocsearchmodel.moc files from toc.moc and
tocmodel.moc files.

These errors I get while running `make`:

CMakeFiles/okularpart.dir/ui/tocsearchmodel.o:/media/d/workspaces/kde/okular/tocmodel.moc:75:
first defined here
CMakeFiles/okularpart.dir/ui/tocmodel.o: In function
`TOCModel::metaObject() const':
/media/d/workspaces/kde/okular/tocmodel.moc:70: multiple definition of
`TOCModel::metaObject() const'
CMakeFiles/okularpart.dir/ui/tocsearchmodel.o:/media/d/workspaces/kde/okular/tocmodel.moc:70:
first defined here
CMakeFiles/okularpart.dir/ui/tocmodel.o:(.data.rel.ro+0x0): multiple
definition of `TOCModel::staticMetaObject'
CMakeFiles/okularpart.dir/ui/tocsearchmodel.o:(.data.rel.ro+0x0): first
defined here
CMakeFiles/okularpart.dir/ui/tocmodel.o: In function
`TOCModel::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)':
/media/d/workspaces/kde/okular/tocmodel.moc:44: multiple definition of
`TOCModel::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)'
CMakeFiles/okularpart.dir/ui/tocsearchmodel.o:/media/d/workspaces/kde/okular/tocmodel.moc:44:
first defined here
CMakeFiles/okularpart.dir/ui/tocmodel.o: In function
`TOCModel::qt_metacall(QMetaObject::Call, int, void**)':
/media/d/workspaces/kde/okular/tocmodel.moc:83: multiple definition of
`TOCModel::qt_metacall(QMetaObject::Call, int, void**)'
CMakeFiles/okularpart.dir/ui/tocsearchmodel.o:/media/d/workspaces/kde/okular/tocmodel.moc:83:
first defined here
CMakeFiles/okularpart.dir/ui/tocmodel.o:(.data.rel.ro+0x10): multiple
definition of `TOCModel::staticMetaObjectExtraData'
CMakeFiles/okularpart.dir/ui/tocsearchmodel.o:(.data.rel.ro+0x10): first
defined here
CMakeFiles/okularpart.dir/ui/tocsearchmodel.o: In function
`TOCSearchModel::TOCSearchModel(Okular::Document*, QObject*)':
tocsearchmodel.cpp:(.text+0x10f8): undefined reference to `vtable for
TOCSearchModel'
CMakeFiles/okularpart.dir/ui/tocsearchmodel.o: In function
`TOCSearchModel::~TOCSearchModel()':
tocsearchmodel.cpp:(.text+0x120c): undefined reference to `vtable for
TOCSearchModel'
collect2: error: ld returned 1 exit status

Some help?
-
Jakub
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/okular-devel/attachments/20121220/1a6e5cc8/attachment.html>


More information about the Okular-devel mailing list