traverso-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Traverso-devel] Linker error (vtable) when adding a new command class


From: Peter Hoppe
Subject: [Traverso-devel] Linker error (vtable) when adding a new command class
Date: Tue, 12 Aug 2008 22:41:40 +0100
User-agent: Thunderbird 2.0.0.14 (X11/20080505)

Hello!

I am still trying to add a new command "SheetPartSelection" to Traverso. 
Unfortunately I'm getting linker errors.

* I created a new class SheetPartSelection which inherits from Command. Two new 
files,

> src/commands/SheetPartSelection.h
> src/commands/SheetPartSelection.cpp.


* I created an entry for SheetPartSelection.cpp in src/commands/CMakeLists.txt 
(added manually)
> SET(TRAVERSO_COMMANDS_SOURCES
> [...]
> SheetPartSelection.cpp
> )

* In SheetPartSelection.h I override all virtual methods mentioned in Command.h
>         SheetPartSelection              (SheetView* sv);
>         ~SheetPartSelection             ();
>     
>         int     begin_hold              ();
>         int     finish_hold             ();
>         int     prepare_actions         ();
>         int     do_action               ();
>         int     undo_action             ();
>         int     jog                     ();
>         void    cancel_action           ();
>         void    set_cursor_shape        (int useX, int useY);
>         void    set_collected_number    (const QString& collected);

* In SheetPartSelection.cpp I implement all methods mentioned in 
SheetPartSelection.h


This all compiles fine, but when it comes to linking, I get this vtable error:

> /home/peter/Documents/programming/traverso/0.42.0/dev/02_cvs/traverso_0.42.0-003/lib/libtraversocommands.a(SheetPartSelection.o):
>  In function `SheetPartSelection::~SheetPartSelection()':
> SheetPartSelection.cpp:(.text+0x1d1): undefined reference to `vtable for 
> SheetPartSelection'
> /home/peter/Documents/programming/traverso/0.42.0/dev/02_cvs/traverso_0.42.0-003/lib/libtraversocommands.a(SheetPartSelection.o):
>  In function `SheetPartSelection::~SheetPartSelection()':
> SheetPartSelection.cpp:(.text+0x261): undefined reference to `vtable for 
> SheetPartSelection'
> /home/peter/Documents/programming/traverso/0.42.0/dev/02_cvs/traverso_0.42.0-003/lib/libtraversocommands.a(SheetPartSelection.o):
>  In function `SheetPartSelection::~SheetPartSelection()':
> SheetPartSelection.cpp:(.text+0x2e1): undefined reference to `vtable for 
> SheetPartSelection'
> make[2]: Leaving directory 
> `/home/peter/Documents/programming/traverso/0.42.0/dev/02_cvs/traverso_0.42.0-003'
> make[1]: Leaving directory 
> `/home/peter/Documents/programming/traverso/0.42.0/dev/02_cvs/traverso_0.42.0-003'
> /home/peter/Documents/programming/traverso/0.42.0/dev/02_cvs/traverso_0.42.0-003/lib/libtraversocommands.a(SheetPartSelection.o):
>  In function `SheetPartSelection::SheetPartSelection(SheetView*)':
> SheetPartSelection.cpp:(.text+0x39e): undefined reference to `vtable for 
> SheetPartSelection'
> /home/peter/Documents/programming/traverso/0.42.0/dev/02_cvs/traverso_0.42.0-003/lib/libtraversocommands.a(SheetPartSelection.o):
>  In function `SheetPartSelection::SheetPartSelection(SheetView*)':
> SheetPartSelection.cpp:(.text+0x47e): undefined reference to `vtable for 
> SheetPartSelection'
> collect2: ld returned 1 exit status
> make[2]: *** [bin/traverso] Error 1
> make[1]: *** [buildfiles/CMakeFiles/traverso.dir/all] Error 2
> make: *** [all] Error 2
> *** Exited with status: 2 ***

According to some literature on the internet this error is given if there are 
non-pure virtual methods declared but not
implemented [1]. However, as far as I can see I did implement every virtual 
method in SheetPartSelection.cpp.

* What have I overlooked?
* Is there a simpler way of adding new files to the project without having to 
hand edit the CMakeLists.txt file?

Thank you very much for your consideration!

P








--------

Some specifics of my machine:
I am using KDevelop 3.5.1 on KDE 3.5.9.
> address@hidden:~$ gcc --version
> gcc (GCC) 4.2.3 (Ubuntu 4.2.3-2ubuntu7)
> 
> address@hidden:~$ cat /etc/issue
> Ubuntu 8.04.1 \n \l
> 
> address@hidden:~$ uname -a
> Linux localhost 2.6.24-19-generic #1 SMP Fri Jul 11 21:01:46 UTC 2008 x86_64 
> GNU/Linux


--------

src/commands/SheetPartSelection.h

> //
> // C++ Interface: SheetSelection
> //
> // Description: 
> //
> //
> // Author: Peter Hoppe <>, (C) 2008
> //
> // Copyright: See COPYING file that comes with this distribution
> //
> //
> #ifndef SHEETPARTSELECTION_H
> #define SHEETPARTSELECTION_H
> 
> #include "Command.h"
> 
> class SheetView;
> class QPoint;
> 
> /**
>  * A command which creates a selection area over part of a sheet. All audio 
> clip parts within that area will 
>  * be split off and mixed down to a new clip. That clip can then be inserted 
> somewhere else.
>  *
>  * @author Peter Hoppe
>  */
> class SheetPartSelection : public Command
> {
>     Q_OBJECT
>     Q_CLASSINFO("select", tr("Select"));
> 
>     public:
>         SheetPartSelection              (SheetView* sv);
>         ~SheetPartSelection             ();
>     
>         int     begin_hold              ();
>         int     finish_hold             ();
>         int     prepare_actions         ();
>         int     do_action               ();
>         int     undo_action             ();
>         int     jog                     ();
>         void    cancel_action           ();
>         void    set_cursor_shape        (int useX, int useY);
>         void    set_collected_number    (const QString& collected);
> 
>     private:
>         SheetView*      m_sv;
> };
> 
> #endif


src/commands/SheetPartSelection.cpp

> //
> // C++ Implementation: SheetSelection
> //
> // Description: 
> //
> //
> // Author: Peter Hoppe <address@hidden>, (C) 2008
> //
> // Copyright: See COPYING file that comes with this distribution
> //
> //
> #include "SheetPartSelection.h"
> 
> #include "SheetView.h"
> #include "Sheet.h"
> #include "ClipsViewPort.h"
> #include "ContextPointer.h"
> #include <QPoint>
> 
> // Always put me below _all_ includes, this is needed
> // in case we run with memory leak detection enabled!
> #include "Debugger.h"
> 
> SheetPartSelection::SheetPartSelection (SheetView* sv)
>  : Command ("Select")
> {
>     PENTERCONS;
>     m_sv = sv;
> }
> 
> 
> SheetPartSelection::~SheetPartSelection()
> {
>     PENTERDES;
> }
> 
> 
> int SheetPartSelection::begin_hold()
> {
>     PENTER;
>     return 0;
> }
> 
> int SheetPartSelection::finish_hold()
> {
>     PENTER;
>     return 0;
> }
> 
> int SheetPartSelection::prepare_actions()
> {
>     PENTER;
>     return 0;
> }
> 
> int SheetPartSelection::do_action()
> {
>     PENTER;
>     return 0;
> }
> 
> int SheetPartSelection::undo_action()
> {
>     PENTER;
>     return 0;
> }
> 
> int SheetPartSelection::jog()
> {
>     PENTER;
>     return 0;
> }
> 
> void SheetPartSelection::cancel_action()
> {
>     PENTER;
> }
> 
> void SheetPartSelection::set_cursor_shape (int useX, int useY)
> {
>     PENTER;
> }
> 
> void set_collected_number (const QString& collected)
> {
>     PENTER;
> }

--------
[1] http://gcc.gnu.org/faq.html#vtables
    http://www.storkyak.com/2006/07/gnu-c-undefined-reference-to-vtable.html

-- 
Fame is probably the second most dangerous occupation after working in a coal 
mine
 - Moby




reply via email to

[Prev in Thread] Current Thread [Next in Thread]