Hey guys,<div><br></div><div>I think I am doing a stupid C++ mistake here: I get the follwing error:</div><div><br></div><div>mediacontainment.cpp:76: undefined reference to &#39;MediaCenter::MediaCenter::State::MediaCenterState(QState*)</div>
<div><br></div><div>The last line of this mail causes the error.</div><div><br></div><div><br></div><div>Here is mediacenterstate.h</div><div><br></div><div><div>#ifndef MEDIACENTERSTATE_H</div><div>#define MEDIACENTERSTATE_H</div>
<div><br></div><div>#include &quot;libs/mediacenter/mediacenter.h&quot;</div><div>#include &quot;libs/mediacenter/mediacenter_export.h&quot;</div><div><br></div><div>#include &lt;QtCore/qabstractstate.h&gt;</div><div>#include &lt;QGraphicsWidget&gt;</div>
<div><br></div><div>#include &lt;Plasma/IconWidget&gt;</div><div><br></div><div>namespace MediaCenter {</div><div>  </div><div>enum State {</div><div>    PictureMode,</div><div>    MusicMode,</div><div>    VideoMode,</div>
<div>    Home</div><div>};</div><div><br></div><div>enum MainSubComponent {</div><div>    JumpToVideoState,</div><div>    JumpToMusicState,</div><div>    JumpToPictureState,</div><div>    JumpToHome,</div><div>    ToggleControlBarAutohide,</div>
<div>    ToggleInfoBarAutohide</div><div>};</div><div>  </div><div>class MEDIACENTER_EXPORT MediaCenterState : public QAbstractState</div><div>{</div><div>    Q_OBJECT</div><div>public:</div><div>    MediaCenterState(QState *parent = 0);</div>
<div>    virtual ~MediaCenterState();</div><div><br></div><div>    QGraphicsWidget *subComponent(MainSubComponent c);</div><div><br></div><div>protected:</div><div>    void onExit(QEvent* event);</div><div>    void onEntry(QEvent* event);</div>
<div><br></div><div>    Plasma::IconWidget *m_jumpToHome;</div><div>};</div><div><br></div><div>} //namespace MediaCenter</div><div>#endif // MEDIACENTERSTATE_H</div><div><br><div class="gmail_quote">here is mediacenterstate.cpp</div>
<div class="gmail_quote"><br></div><div class="gmail_quote"><div class="gmail_quote">#include &quot;mediacenterstate.h&quot;</div><div class="gmail_quote"><br></div><div class="gmail_quote">using namespace MediaCenter;</div>
<div class="gmail_quote"><br></div><div class="gmail_quote">MediaCenterState::MediaCenterState (QState *parent) : QAbstractState(parent),</div><div class="gmail_quote">    m_jumpToHome(new Plasma::IconWidget())</div><div class="gmail_quote">
{</div><div class="gmail_quote">}</div><div class="gmail_quote"><br></div><div class="gmail_quote">MediaCenterState::~MediaCenterState()</div><div class="gmail_quote">{</div><div class="gmail_quote">}</div><div class="gmail_quote">
<br></div><div class="gmail_quote">void MediaCenterState::onExit(QEvent *event)</div><div class="gmail_quote">{</div><div class="gmail_quote">    Q_UNUSED(event);</div><div class="gmail_quote">}</div><div class="gmail_quote">
<br></div><div class="gmail_quote">void MediaCenterState::onEntry(QEvent *event)</div><div class="gmail_quote">{</div><div class="gmail_quote">    Q_UNUSED(event);</div><div class="gmail_quote">}</div><div class="gmail_quote">
<br></div><div class="gmail_quote">QGraphicsWidget *MediaCenterState::subComponent(MediaCenter::MainSubComponent c)</div><div class="gmail_quote">{</div><div class="gmail_quote">    if (c == MediaCenter::JumpToHome) {</div>
<div class="gmail_quote">        m_jumpToHome-&gt;setIcon(&quot;User-Folder&quot;);</div><div class="gmail_quote">        return m_jumpToHome;</div><div class="gmail_quote">    }</div><div class="gmail_quote">}</div><div>
<br></div><div><br></div><div>here is mediacontainment.h</div><div><br></div><div><div>#ifndef MEDIACONTAINMENT_H</div><div>#define MEDIACONTAINMENT_H</div><div><br></div><div>#include &quot;mediacenter/mediacenter.h&quot;</div>
<div>#include &quot;states/mediacenterstate.h&quot;</div><div><br></div><div>#include &lt;Plasma/Containment&gt;</div><div>#include &lt;QList&gt;</div><div><br></div><div>class QAction;</div><div>class QPointF;</div><div>
namespace MediaCenter {</div><div>    class Browser;</div><div>    class PlaybackControl;</div><div>    class Playlist;</div><div>    class Player;</div><div>    class PictureState;</div><div>    class VideoState;</div><div>
}</div><div><br></div><div>class MediaLayout;</div><div><br></div><div>class MediaContainment : public Plasma::Containment</div><div>{</div><div>    Q_OBJECT</div><div>public:</div><div>    MediaContainment(QObject *parent, const QVariantList &amp;args);</div>
<div>    ~MediaContainment();</div><div><br></div><div>    QList&lt;QAction*&gt; contextualActions();</div><div><br></div><div>    MediaCenter::State currentState();</div><div>    void setCurrentState(MediaCenter::State);</div>
<div><br></div><div>    QList&lt;QGraphicsWidget*&gt; currentMainComponents();</div><div>    void addCurrentMainComponent(QGraphicsWidget*);</div><div><br></div><div>    QList&lt;QGraphicsWidget*&gt; currentSubComponents();</div>
<div>    void addCurrentSubComponent(QGraphicsWidget*);</div><div><br></div><div>protected:</div><div>    void constraintsEvent(Plasma::Constraints constraints);</div><div><br></div><div>private slots:</div><div>    void slotAppletAdded(Plasma::Applet *applet, const QPointF &amp;pos);</div>
<div>    void slotAppletRemoved(Plasma::Applet *applet);</div><div>    void switchState(MediaCenter::State);</div><div><br></div><div>    void switchToPictureState();</div><div>    void switchToVideoState();</div><div>    void switchToMusicState();</div>
<div><br></div><div>private:</div><div>    MediaCenter::Browser *m_browser;</div><div>    MediaCenter::PlaybackControl *m_control;</div><div>    MediaCenter::Playlist *m_playlist;</div><div>    MediaCenter::Player *m_player;</div>
<div><br></div><div>    MediaCenter::State m_currentState;</div><div>    MediaCenter::State m_previousState;</div><div><br></div><div>    MediaCenter::MediaCenterState *m_mediaCenterState;</div><div>    MediaCenter::VideoState *m_videoState;</div>
<div>    MediaCenter::PictureState *m_pictureState;</div><div><br></div><div>    QList&lt;QGraphicsWidget*&gt; m_currentMainComponents;</div><div>    QList&lt;QGraphicsWidget*&gt; m_currentSubComponents;</div><div><br></div>
<div>    bool m_musicIsPlaying;</div><div><br></div><div>    MediaLayout *m_layout;</div><div><br></div><div>    void addMediaApplet(Plasma::Applet *);</div><div><br></div><div>    void initControls();</div><div>    void connectControls(MediaCenter::State);</div>
<div><br></div><div>    //we need these to give full control to the containment and avoid cycling signals with the controller</div><div>    //the controller&#39;s buttons are connected to these</div><div>    void controlBarToPictureState();</div>
<div>    void controlBarToVideoState();</div><div>    void controlBarToMusicState();</div><div><br></div><div>    void startStateMachine();</div><div>};</div><div><br></div><div><br></div><div>and here the relevant part of mediacontainment.cpp</div>
<div><br></div><div><div>#include &quot;mediacontainment.h&quot;</div><div>#include &quot;medianotificationwidget.h&quot;</div><div>#include &quot;medialayout.h&quot;</div><div>#include &quot;mediatoolbox.h&quot;</div><div>
<br></div><div>#include &lt;mediacenter/browser.h&gt;</div><div>#include &lt;mediacenter/playbackcontrol.h&gt;</div><div>#include &lt;mediacenter/playlist.h&gt;</div><div>#include &lt;mediacenter/player.h&gt;</div><div><br>
</div><div>#include &lt;states/videostate.h&gt;</div><div>#include &lt;states/picturestate.h&gt;</div><div><br></div><div>// Qt</div><div>#include &lt;QAction&gt;</div><div>#include &lt;QStateMachine&gt;</div><div><br></div>
<div>// KDE</div><div>#include &lt;KDebug&gt;</div><div>#include &lt;KNotification&gt;</div><div>#include &lt;KLocale&gt;</div><div><br></div><div>static const int BROWSER_WIDTH = 300;</div><div>static const int BROWSER_HEIGHT = 100;</div>
<div><br></div><div><br></div><div>K_EXPORT_PLASMA_APPLET(mediacontainment, MediaContainment)</div><div><br></div><div>MediaContainment::MediaContainment(QObject *parent, const QVariantList &amp;args) : Plasma::Containment(parent, args),</div>
<div>m_browser(0),</div><div>m_control(0),</div><div>m_playlist(0),</div><div>m_player(0),</div><div>m_pictureState(0),</div><div>m_currentState(MediaCenter::PictureMode),</div><div>m_previousState(MediaCenter::PictureMode),</div>
<div>m_musicIsPlaying(false),</div><div>m_layout(new MediaLayout(this))</div><div>{</div><div>    setContainmentType(Plasma::Containment::CustomContainment);</div><div>    setHasConfigurationInterface(true);</div><div>    setAcceptHoverEvents(true);</div>
<div>    setToolBox(new MediaToolBox(this));</div><div><br></div><div>    connect (toolBox(), SIGNAL(toggled()), m_layout, SLOT(toggleShowAllMediaApplets()));</div><div>}</div><div><br></div><div>MediaContainment::~MediaContainment()</div>
<div>{}</div><div><br></div><div>void MediaContainment::startStateMachine()</div><div>{</div><div>    //Prepare StateMachine</div><div>    QStateMachine machine; //this is not a pointer</div><div><br></div><div>    //Set up all possible states</div>
<div>    m_mediaCenterState = new MediaCenter::MediaCenterState(); //these are pointers</div></div></div></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div class="h5"><br>
</div></div></blockquote></div><br></div></div>