traverso-devel
[Top][All Lists]
Advanced

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

[Traverso-devel] Re: Linker error (vtable) when adding a new command cla


From: Peter Hoppe
Subject: [Traverso-devel] Re: Linker error (vtable) when adding a new command class
Date: Wed, 13 Aug 2008 18:36:41 +0100
User-agent: Thunderbird 2.0.0.14 (X11/20080505)

> Hi Peter,
>
> If there is the macro Q_OBJECT in the header file you created, you'll have to
> add the source file also to the moc_sources in the CMakeList.txt file.
>
> That should fix it, if not, please let me know.
>
>
> Regards,
>
> Remon



It fixed it! I actually had to add the header file (SheetPartSelection.h) to 
the TRAVERSO_COMMANDS_MOC_CLASSES section
of the CMakeLists.txt file. And congrats for your new job, and good success! 
Thanks for your time and patience.

P

---------------------------------------------------------------------------------------------------

For anybody with a similar problem - I had to include the source file

> /src/commands/SheetPartSelection.cpp

into the TRAVERSO_COMMANDS_SOURCES section of the

> /src/commands/CMakeLists.txt

file. Since the SheetPartSelection class does have the QOBJECT macro in its 
header, I also have mention the header file
in the TRAVERSO_COMMANDS_MOC_CLASSES section of said CMakeLists.txt file. I 
have pasted the three files,
/src/commands/SheetPartSelection.h, /src/commands/SheetPartSelection.cpp and 
CMakeLists.txt at the bottom of this mail,
so it's clearer what I've done. Hope this helps any poor soul fighting with 
vtable errors...

P


-------------------------------------------------------------------------------------------
/src/commands/SheetPartSelection.h
-------------------------------------------------------------------------------------------

//
// C++ Interface: SheetSelection
//
// Description:
//
//
// Author: Remon Sijrier <>, (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);

        // Even though the following method is virtual in the base class 
(Command), the linker shows another
        // error, when this method is declared here and implemented in the 
SheetPartSelection.cpp
        // source file. It may have to do with the fact that this method is 
implemented in Command.cpp
        // and contains the statement Q_UNUSED (collected).
        // We have this method disabled for now. It's probably not important 
anyway.
        // 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;
}



-------------------------------------------------------------------------------------------
/src/commands/CMakeLists.txt
-------------------------------------------------------------------------------------------

ADD_SUBDIRECTORY(plugins ${TRAVERSO_BUILD_DIR})

INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}/src/commands
${CMAKE_SOURCE_DIR}/src/common
${CMAKE_SOURCE_DIR}/src/core
${CMAKE_SOURCE_DIR}/src/traverso
${CMAKE_SOURCE_DIR}/src/sheetcanvas
${CMAKE_SOURCE_DIR}/src/plugins
${CMAKE_SOURCE_DIR}/src/plugins/native
${QT_QTGUI_INCLUDE_DIR}
${QT_QTXML_INCLUDE_DIR}
)

SET(TRAVERSO_COMMANDS_SOURCES
AudioClipExternalProcessing.cpp
AddRemove.cpp
ClipSelection.cpp
CommandGroup.cpp
ExternalProcessingDialog.cpp
Fade.cpp
Gain.cpp
Import.cpp
MoveClip.cpp
MoveEdge.cpp
PCommand.cpp
SplitClip.cpp
TrackPan.cpp
Zoom.cpp
Scroll.cpp
ArmTracks.cpp
PlayHeadMove.cpp
WorkCursorMove.cpp
RemoveClip.cpp
SheetPartSelection.cpp
)

SET(TRAVERSO_COMMANDS_MOC_CLASSES
ExternalProcessingDialog.h
Gain.h
MoveClip.h
TrackPan.h
Zoom.h
SheetPartSelection.h
)

SET(TRAVERSO_COMMANDS_UI_FILES
ui/ExternalProcessingDialog.ui
)

QT4_WRAP_CPP(TRAVERSO_COMMANDS_MOC_SOURCES ${TRAVERSO_COMMANDS_MOC_CLASSES})
QT4_WRAP_UI(TRAVERSO_COMMANDS_UI_SOURCES ${TRAVERSO_COMMANDS_UI_FILES})


SET(TRAVERSO_COMMANDS_LIBRARY "traversocommands")

ADD_LIBRARY(${TRAVERSO_COMMANDS_LIBRARY} STATIC  ${TRAVERSO_COMMANDS_SOURCES} 
${TRAVERSO_COMMANDS_UI_SOURCES}
${TRAVERSO_COMMANDS_MOC_SOURCES})

TARGET_LINK_LIBRARIES(traversocommands
        traversocore
)

IF(USE_PCH)
    ADD_DEPENDENCIES(traversocommands precompiled_headers)
ENDIF(USE_PCH)




-- 
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]