×

Discussion Board

Results 1 to 14 of 14

Thread: compile errors

  1. #1
    Registered User
    Join Date
    Aug 2008
    Posts
    71

    compile errors

    I write a program , that has 3 classes , for simple , let us call them A , B and C
    In the .h files , I wrote

    "ifndef ..._H
    define ..._H
    ...
    #endif"


    A is the controller, B and C are two viewers .
    I let A includes the .h files of B and C . B includes B.h , and C includes C.h
    But I get the error "collect2: ld returned 1 exit status"
    when I check the compile information , it told me that "multiple definition of ..."
    That is the problem , when I build it , there is no error , when link ,the error come out .
    Could anyone tell me how to solve the problem ?

  2. #2
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: compile errors

    You have multiple modules and each is doing a DEFINITION of the same entity. Note that a DEFINITION is different from a DECLARATION.

    In general, with a few notable exceptions used in "advanced" programming situation, only DECLARATIONS should be placed in includes.

  3. #3
    Registered User
    Join Date
    Aug 2008
    Posts
    71

    Re: compile errors

    Thank you very much for your help !
    when I build the project , there is no problems , but when I linked them , the errors come out ,
    the compiler tell me " multiple definition of B::fun() " , total 3 functions (not all functions ) encounter errors .
    If it comes from the multiple modules , why don't all the functions encounter errors , just 3 funcions ?
    If not , where could the problems come from ?
    May it comes from .h files ?
    this is the code:
    widgetcontroller.h
    #ifndef WIDGETCONTROLLER_H
    #define WIDGETCONTROLLER_H

    #include <QWidget>


    QT_BEGIN_HEADER

    QT_BEGIN_NAMESPACE



    #include <QListWidgetItem>
    #include <QStackedWidget>
    #include <QVBoxLayout>

    namespace Ui {
    class WidgetController;
    }

    class WidgetController : public QWidget
    {
    Q_OBJECT

    public:
    explicit WidgetController(QWidget *parent = 0);
    ~WidgetController();
    public slots:
    /**
    * setContactsWidgetCurrent
    * Sets the contactsWidget as current widget.
    */
    void setContentWidgetCurrent(QListWidgetItem* item);

    /**
    * setMessageWidgetCurrent
    * Sets the messageWidget as current widget.
    */
    void setMessageWidgetCurrent();

    private:
    Ui::WidgetController *ui;
    QStackedWidget *stackedWidget;
    // MessageWidget *messageWidget;
    // ContentWidget *contentWidget;
    };

    QT_END_NAMESPACE

    QT_END_HEADER


    #endif // WIDGETCONTROLLER_H
    widgetcontroller.cpp

    #include "widgetcontroller.h"
    #include "ui_widgetcontroller.h"
    #include "messagewidget.h"
    #include "contentwidget.h"

    WidgetController::WidgetController(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::WidgetController)
    {
    ui->setupUi(this);

    MessageWidget* messageWidget = new MessageWidget();
    ContentWidget* contentWidget = new ContentWidget();

    stackedWidget = new QStackedWidget();
    stackedWidget->addWidget(messageWidget);
    stackedWidget->addWidget(contentWidget);

    stackedWidget->setCurrentIndex(0); // messageWidget

    QVBoxLayout *layout = new QVBoxLayout();
    layout->addWidget(stackedWidget);
    setLayout(layout);

    connect(messageWidget, SIGNAL(readSMS(QListWidgetItem* item)),
    contentWidget, SLOT(display(QListWidgetItem* item)));

    connect(contentWidget, SIGNAL(deleteSMS()),
    messageWidget, SLOT(deleteSMS()));

    connect(messageWidget, SIGNAL(readSMS(QListWidgetItem* item)),
    this, SLOT(setContentWidgetCurrent(QListWidgetItem* item)));

    connect(contentWidget, SIGNAL(backToMessageList()),
    this, SLOT(setMessageWidgetCurrent()));

    }

    WidgetController::~WidgetController()
    {
    delete ui;
    }

    void WidgetController::setContentWidgetCurrent(QListWidgetItem* item)
    {
    stackedWidget->setCurrentIndex(1); // ContentWidget
    }

    void WidgetController::setMessageWidgetCurrent()
    {
    stackedWidget->setCurrentIndex(0); // messageWidget
    }
    messagewidget.h
    #ifndef MESSAGEWIDGET_H
    #define MESSAGEWIDGET_H

    #include <QWidget>

    // INCLUDES
    class QWidget;
    class QListWidget;
    class QListWidgetItem;
    class QVBoxLayout;
    class QString;
    class QToolBar;
    class QAction;

    class MessageWidget : public QWidget
    {
    Q_OBJECT
    public:
    explicit MessageWidget(QWidget *parent = 0);

    // used by the widgetcontroller , dilivery the currentItem
    QListWidgetItem *getCurrentItem();

    signals:
    // read current item
    void readSMS(QListWidgetItem* item);


    public slots:
    // delete current item
    void deleteSMS();
    // just use to emit readSMS(QListWidgetItem* item)
    void read();

    private:
    /**
    * createActions
    * Creates actions and connects them to slots.
    */
    // void createActions();

    /**
    * createMenus
    * Creates a menubar and adds a menu with actions
    * to it.
    */
    // void createMenus();

    void initList();

    void initToolbar();

    void initAll();

    private:
    /**
    * listWidget list widget for recipients
    * Owned by ContactsWidget object, instantiated in
    * constructor, populated in readContactsFromDbL.
    */
    QListWidget *listWidget;

    QVBoxLayout *layout ;
    QToolBar *bar;
    // QToolButton *button_delete;
    // QToolButton *button_read;
    QAction *act_delete;
    QAction *act_read;


    };


    #endif // MESSAGEWIDGET_H


    messagewidget.cpp
    #include <QWidget>
    #include <QList>
    #include <QListWidget>
    #include <QListWidgetItem>
    #include <QVBoxLayout>
    #include <QString>
    #include <QToolBar>
    #include <QAction>
    #include "messagewidget.h"
    MessageWidget::MessageWidget(QWidget *parent) :
    QWidget(parent)
    {
    initAll();
    // setLayout(layout);

    // listWidget->setCurrentRow(0);
    }


    void MessageWidget::initList()
    {
    listWidget = new QListWidget(this);
    listWidget->addItem(new QListWidgetItem("Oa\nk"));
    listWidget->addItem(new QListWidgetItem("Ba\nnana"));
    listWidget->addItem(new QListWidgetItem("Appl\ne"));
    listWidget->addItem(new QListWidgetItem("Orange\n"));
    listWidget->addItem(new QListWidgetItem("Grape\ns"));
    listWidget->addItem(new QListWidgetItem("Jaye\nsh"));
    listWidget->addItem(new QListWidgetItem("Pineapple"));
    listWidget->addItem(new QListWidgetItem("GROUNDNUT"));
    listWidget->addItem(new QListWidgetItem("Sugarcane"));
    listWidget->addItem(new QListWidgetItem("Coconut"));
    listWidget->addItem(new QListWidgetItem("Jaye\nsh"));
    listWidget->addItem(new QListWidgetItem("Pineapple"));
    listWidget->addItem(new QListWidgetItem("GROUNDNUT"));
    listWidget->addItem(new QListWidgetItem("Sugarcane"));
    listWidget->addItem(new QListWidgetItem("Coconut"));
    listWidget->addItem(new QListWidgetItem("Jaye\nsh"));
    listWidget->addItem(new QListWidgetItem("Pineapple"));
    listWidget->addItem(new QListWidgetItem("GROUNDNUT"));
    listWidget->addItem(new QListWidgetItem("Sugarcane"));
    listWidget->addItem(new QListWidgetItem("Coconut"));

    listWidget->setCurrentRow(3);

    }

    void MessageWidget::initToolbar()
    {
    bar = new QToolBar();
    act_delete = new QAction("delete" , this );
    act_read = new QAction("read" , this );
    bar->addAction(act_delete);
    bar->addSeparator();
    bar->addAction(act_read);
    }

    void MessageWidget::initAll()
    {
    initList();
    initToolbar();

    layout = new QVBoxLayout();
    layout->addWidget(listWidget);
    layout->addWidget(bar);
    setLayout(layout);

    QObject::connect(listWidget , SIGNAL(itemDoubleClicked(QListWidgetItem*))
    , this , SIGNAL(readSMS(QListWidgetItem*)));
    QObject::connect(act_delete , SIGNAL(triggered())
    , this , SLOT(deleteSMS()));
    QObject::connect(act_read , SIGNAL(triggered())
    , this , SLOT(read()));

    }

    QListWidgetItem* MessageWidget::getCurrentItem()
    {
    return listWidget->currentItem();
    }

    void MessageWidget::readSMS(QListWidgetItem*)
    {
    }

    void MessageWidget::read()
    {
    emit readSMS(listWidget->currentItem());
    }

    void MessageWidget::deleteSMS()
    {
    int currentRow = listWidget->row(listWidget->currentItem());
    listWidget->removeItemWidget(listWidget->currentItem());

    currentRow++ ;
    if( currentRow >= listWidget->count() )
    currentRow = 0 ;
    else
    listWidget->setCurrentRow( currentRow );
    }

    contentwidget.h
    #ifndef CONTENTWIDGET_H
    #define CONTENTWIDGET_H

    #include <QWidget>

    class QTextEdit;
    class QLineEdit;
    class QListWidgetItem;
    class QToolBar;
    class QAction;
    class QVBoxLayout;
    class QString;


    class ContentWidget : public QWidget
    {
    Q_OBJECT
    public:
    explicit ContentWidget(QWidget *parent = 0);

    signals:
    // tell widgetcontroller to delete the current SMS
    void deleteSMS();

    // tell widgetController to set focus on messageWidget
    void backToMessageList();

    public slots:
    // show the detail information of the SMS
    void display(QListWidgetItem*item);


    private:

    void initToolbar();

    private:
    QTextEdit *textEdit;
    QVBoxLayout *layout ;
    QLineEdit *phone_num;

    QToolBar *bar;
    QAction *act_delete;
    QAction *act_return;
    };

    #endif // CONTENTWIDGET_H
    contentwidget.cpp
    #include "contentwidget.h"
    #include <QTextEdit>
    #include <QLineEdit>
    #include <QListWidgetItem>
    #include <QToolBar>
    #include <QAction>
    #include <QVBoxLayout>
    #include <QString>




    ContentWidget::ContentWidget(QWidget *parent) :
    QWidget(parent)
    {
    initToolbar();
    layout = new QVBoxLayout();
    phone_num = new QLineEdit();
    textEdit = new QTextEdit();
    phone_num->setReadOnly(true);
    textEdit->setReadOnly(true);
    layout->addWidget( phone_num );
    layout->addWidget( textEdit );
    layout->addWidget( bar );



    QObject::connect(act_delete , SIGNAL(triggered())
    , this , SIGNAL(deleteSMS()));
    QObject::connect(act_return , SIGNAL(triggered())
    , this , SIGNAL(backToMessageList()));

    }

    void ContentWidget::display(QListWidgetItem *item)
    {
    textEdit->setText(item->text());
    phone_num->setText("15846387916");
    }

    void ContentWidget::deleteSMS()
    {
    // the real deletion steps are in MessageWidget::deleteSMS()

    // and back to MesaageList is needed
    emit backToMessageList();
    }

    void ContentWidget::backToMessageList()
    {
    }


    void ContentWidget::initToolbar()
    {
    bar = new QToolBar();
    act_delete = new QAction("delete" , this );
    act_return = new QAction("return" , this );
    bar->addAction(act_delete);
    bar->addSeparator();
    bar->addAction(act_return);
    }

  4. #4
    Registered User
    Join Date
    May 2009
    Location
    Guatemala
    Posts
    186

    Re: compile errors

    I would recommend posting your exact and complete error messages.
    -CarlosDL

  5. #5
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: compile errors

    What did it say that there are multiple definitions of? That's what you multiply defined -- one definition in each module you compiled.

    Please look up the C/C++ definitions of "DECLARATION" and "DEFINITION".

  6. #6
    Registered User
    Join Date
    Aug 2008
    Posts
    71

    Re: compile errors

    Thank you very much !
    this is the error code that the compiler gave:

    mingw32-make[1]: Leaving directory `D:/Projects/Qt/new_list-build-simulator'

    mingw32-make: Leaving directory `D:/Projects/Qt/new_list-build-simulator'

    debug/moc_messagewidget.o:\Projects\Qt\new_list-build-simulator/debug/moc_messagewidget.cpp:89: multiple definition of `MessageWidget::readSMS(QListWidgetItem*)'

    debug/messagewidget.o:\Projects\Qt\new_list-build-simulator/../new_list/messagewidget.cpp:87: first defined here

    debug/moc_contentwidget.o:\Projects\Qt\new_list-build-simulator/debug/moc_contentwidget.cpp:90: multiple definition of `ContentWidget::deleteSMS()'

    debug/contentwidget.o:\Projects\Qt\new_list-build-simulator/../new_list/contentwidget.cpp:42: first defined here

    debug/moc_contentwidget.o:\Projects\Qt\new_list-build-simulator/debug/moc_contentwidget.cpp:96: multiple definition of `ContentWidget::backToMessageList()'

    debug/contentwidget.o:\Projects\Qt\new_list-build-simulator/../new_list/contentwidget.cpp:50: first defined here

    collect2: ld returned 1 exit status

  7. #7
    Registered User
    Join Date
    May 2009
    Location
    Guatemala
    Posts
    186

    Re: compile errors

    This connection could be causing the problem:

    Code:
    connect(messageWidget, SIGNAL(readSMS(QListWidgetItem* item)),
    contentWidget, SLOT(display(QListWidgetItem* item)));
    You should only include the argument type when connecting signals and slots (i.e. remove 'item').
    -CarlosDL

  8. #8
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: compile errors

    Yep, Qt is moc_ing you. Your syntax error in the connect is not being detected by the moc compiler during the compile and it thus generates a bogus second definition in the moc_ module.

    Actually READING and trying to understand the error messages very often leads you directly to the cause of the problem.

  9. #9
    Registered User
    Join Date
    Aug 2008
    Posts
    71

    Re: compile errors

    Thanks to all of you very much!
    I tried to disable all the "connect(..)" with " /* ... */ ", compiler still give me the same error until I disable all the "signal" s , the program could run .
    I tried to define another function , I found if only I define a "signal" , the complier will give me "multiple definition of ..."
    how could I solve this ?

  10. #10
    Registered User
    Join Date
    May 2009
    Location
    Guatemala
    Posts
    186

    Re: compile errors

    You should post your new code with just one signal, and without connections, and the error message you get; so we can take a look.
    -CarlosDL

  11. #11
    Registered User
    Join Date
    Aug 2008
    Posts
    71

    Re: compile errors

    in this code , I just turn off all the "connect"s , and disable all the "signal"s , just leave one "signal" in MessageWidget which is called test()
    This is the "twidgetcontroller.h"
    #ifndef WIDGETCONTROLLER_H
    #define WIDGETCONTROLLER_H

    #include <QWidget>


    QT_BEGIN_HEADER

    QT_BEGIN_NAMESPACE



    #include <QListWidgetItem>
    #include <QStackedWidget>
    #include <QVBoxLayout>

    namespace Ui {
    class WidgetController;
    }

    class WidgetController : public QWidget
    {
    Q_OBJECT

    public:
    explicit WidgetController(QWidget *parent = 0);
    ~WidgetController();
    public slots:
    /**
    * setContactsWidgetCurrent
    * Sets the contactsWidget as current widget.
    */
    // void setContentWidgetCurrent(QListWidgetItem* item);

    /**
    * setMessageWidgetCurrent
    * Sets the messageWidget as current widget.
    */
    // void setMessageWidgetCurrent();

    private:
    Ui::WidgetController *ui;
    QStackedWidget *stackedWidget;

    };

    QT_END_NAMESPACE

    QT_END_HEADER


    #endif // WIDGETCONTROLLER_H
    contentwidget.cpp
    #include "widgetcontroller.h"
    #include "ui_widgetcontroller.h"
    #include "messagewidget.h"
    //#include "contentwidget.h"

    WidgetController::WidgetController(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::WidgetController)
    {
    ui->setupUi(this);

    MessageWidget* messageWidget = new MessageWidget();
    /* ContentWidget* contentWidget = new ContentWidget();
    */
    stackedWidget = new QStackedWidget();
    stackedWidget->addWidget(messageWidget);
    /* stackedWidget->addWidget(contentWidget);
    */
    stackedWidget->setCurrentIndex(0); // messageWidget

    QVBoxLayout *layout = new QVBoxLayout();
    layout->addWidget(stackedWidget);
    setLayout(layout);
    /*
    connect(messageWidget, SIGNAL(readSMS(QListWidgetItem*)),
    contentWidget, SLOT(display(QListWidgetItem*)));

    connect(contentWidget, SIGNAL(deleteSMS()),
    messageWidget, SLOT(deleteSMS()));

    connect(messageWidget, SIGNAL(readSMS(QListWidgetItem*)),
    this, SLOT(setContentWidgetCurrent(QListWidgetItem*)));

    connect(contentWidget, SIGNAL(backToMessageList()),
    this, SLOT(setMessageWidgetCurrent()));
    */
    }

    WidgetController::~WidgetController()
    {
    delete ui;
    }
    /*
    void WidgetController::setContentWidgetCurrent(QListWidgetItem* item)
    {
    stackedWidget->setCurrentIndex(1); // ContentWidget
    }

    void WidgetController::setMessageWidgetCurrent()
    {
    stackedWidget->setCurrentIndex(0); // messageWidget
    }
    */
    messagewidget.h
    #ifndef MESSAGEWIDGET_H
    #define MESSAGEWIDGET_H

    #include <QWidget>

    QT_BEGIN_HEADER

    QT_BEGIN_NAMESPACE


    // INCLUDES
    class QWidget;
    class QListWidget;
    class QListWidgetItem;
    class QVBoxLayout;
    class QString;
    class QToolBar;
    class QAction;

    class MessageWidget : public QWidget
    {
    Q_OBJECT
    public:
    explicit MessageWidget(QWidget *parent = 0);

    // used by the widgetcontroller , dilivery the currentItem
    QListWidgetItem *getCurrentItem();

    signals:
    // read current item
    // void readSMS(QListWidgetItem* item);

    void test();

    public slots:
    // delete current item
    // void deleteSMS();
    // just use to emit readSMS(QListWidgetItem* item)
    void read();

    private:
    /**
    * createActions
    * Creates actions and connects them to slots.
    */
    // void createActions();

    /**
    * createMenus
    * Creates a menubar and adds a menu with actions
    * to it.
    */
    // void createMenus();

    void initList();

    void initToolbar();

    void initAll();

    private:
    /**
    * listWidget list widget for recipients
    * Owned by ContactsWidget object, instantiated in
    * constructor, populated in readContactsFromDbL.
    */
    QListWidget *listWidget;

    QVBoxLayout *layout ;
    QToolBar *bar;
    // QToolButton *button_delete;
    // QToolButton *button_read;
    QAction *act_delete;
    QAction *act_read;


    };



    QT_END_NAMESPACE

    QT_END_HEADER


    #endif // MESSAGEWIDGET_H
    messagewidget.cpp
    // INCLUDES
    #include <QWidget>
    #include <QList>
    #include <QListWidget>
    #include <QListWidgetItem>
    #include <QVBoxLayout>
    #include <QString>
    #include <QToolBar>
    #include <QAction>


    #include "messagewidget.h"

    MessageWidget::MessageWidget(QWidget *parent) :
    QWidget(parent)
    {
    initAll();
    // setLayout(layout);

    // listWidget->setCurrentRow(0);
    }


    void MessageWidget::initList()
    {
    listWidget = new QListWidget(this);
    listWidget->addItem(new QListWidgetItem("Oa\nk"));
    listWidget->addItem(new QListWidgetItem("Ba\nnana"));
    listWidget->addItem(new QListWidgetItem("Appl\ne"));
    listWidget->addItem(new QListWidgetItem("Orange\n"));
    listWidget->addItem(new QListWidgetItem("Grape\ns"));
    listWidget->addItem(new QListWidgetItem("Jaye\nsh"));
    listWidget->addItem(new QListWidgetItem("Pineapple"));
    listWidget->addItem(new QListWidgetItem("GROUNDNUT"));
    listWidget->addItem(new QListWidgetItem("Sugarcane"));
    listWidget->addItem(new QListWidgetItem("Coconut"));
    listWidget->addItem(new QListWidgetItem("Jaye\nsh"));
    listWidget->addItem(new QListWidgetItem("Pineapple"));
    listWidget->addItem(new QListWidgetItem("GROUNDNUT"));
    listWidget->addItem(new QListWidgetItem("Sugarcane"));
    listWidget->addItem(new QListWidgetItem("Coconut"));
    listWidget->addItem(new QListWidgetItem("Jaye\nsh"));
    listWidget->addItem(new QListWidgetItem("Pineapple"));
    listWidget->addItem(new QListWidgetItem("GROUNDNUT"));
    listWidget->addItem(new QListWidgetItem("Sugarcane"));
    listWidget->addItem(new QListWidgetItem("Coconut"));

    listWidget->setCurrentRow(3);

    }

    void MessageWidget::initToolbar()
    {
    bar = new QToolBar();
    act_delete = new QAction("delete" , this );
    act_read = new QAction("read" , this );
    bar->addAction(act_delete);
    bar->addSeparator();
    bar->addAction(act_read);
    }

    void MessageWidget::initAll()
    {
    initList();
    initToolbar();

    layout = new QVBoxLayout();
    layout->addWidget(listWidget);
    layout->addWidget(bar);
    setLayout(layout);
    /*
    QObject::connect(listWidget , SIGNAL(itemDoubleClicked(QListWidgetItem*))
    , this , SIGNAL(readSMS(QListWidgetItem*)));
    QObject::connect(act_delete , SIGNAL(triggered())
    , this , SLOT(deleteSMS()));
    QObject::connect(act_read , SIGNAL(triggered())
    , this , SLOT(read()));
    */
    }

    QListWidgetItem* MessageWidget::getCurrentItem()
    {
    return listWidget->currentItem();
    }
    /*
    void MessageWidget::readSMS(QListWidgetItem* item)
    {
    }
    */
    void MessageWidget::read()
    {
    // emit readSMS(listWidget->currentItem());
    }
    /*
    void MessageWidget::deleteSMS()
    {
    int currentRow = listWidget->row(listWidget->currentItem());
    listWidget->removeItemWidget(listWidget->currentItem());

    currentRow++ ;
    if( currentRow >= listWidget->count() )
    currentRow = 0 ;
    else
    listWidget->setCurrentRow( currentRow );
    }

    */

    void MessageWidget::test()
    {
    }
    contentwidget.h
    #ifndef CONTENTWIDGET_H
    #define CONTENTWIDGET_H

    #include <QWidget>

    class QTextEdit;
    class QLineEdit;
    class QListWidgetItem;
    class QToolBar;
    class QAction;
    class QVBoxLayout;
    class QString;


    class ContentWidget : public QWidget
    {
    Q_OBJECT
    public:
    explicit ContentWidget(QWidget *parent = 0);

    signals:
    // tell widgetcontroller to delete the current SMS
    // void deleteSMS();

    // tell widgetController to set focus on messageWidget
    // void backToMessageList();

    public slots:
    // show the detail information of the SMS
    void display(QListWidgetItem*item);


    private:

    void initToolbar();

    private:
    QTextEdit *textEdit;
    QVBoxLayout *layout ;
    QLineEdit *phone_num;

    QToolBar *bar;
    QAction *act_delete;
    QAction *act_return;
    };

    #endif // CONTENTWIDGET_H
    contentwidget.cpp
    #include "contentwidget.h"
    #include <QTextEdit>
    #include <QLineEdit>
    #include <QListWidgetItem>
    #include <QToolBar>
    #include <QAction>
    #include <QVBoxLayout>
    #include <QString>




    ContentWidget::ContentWidget(QWidget *parent) :
    QWidget(parent)
    {
    initToolbar();
    layout = new QVBoxLayout();
    phone_num = new QLineEdit();
    textEdit = new QTextEdit();
    phone_num->setReadOnly(true);
    textEdit->setReadOnly(true);
    layout->addWidget( phone_num );
    layout->addWidget( textEdit );
    layout->addWidget( bar );


    /*
    QObject::connect(act_delete , SIGNAL(triggered())
    , this , SIGNAL(deleteSMS()));
    QObject::connect(act_return , SIGNAL(triggered())
    , this , SIGNAL(backToMessageList()));
    */
    }

    void ContentWidget::display(QListWidgetItem *item)
    {
    textEdit->setText(item->text());
    phone_num->setText("15846387916");
    }
    /*
    void ContentWidget::deleteSMS()
    {
    // the real deletion steps are in MessageWidget::deleteSMS()

    // and back to MesaageList is needed
    // emit backToMessageList();
    }
    */
    /*
    void ContentWidget::backToMessageList()
    {
    }

    */
    void ContentWidget::initToolbar()
    {
    bar = new QToolBar();
    act_delete = new QAction("delete" , this );
    act_return = new QAction("return" , this );
    bar->addAction(act_delete);
    bar->addSeparator();
    bar->addAction(act_return);
    }

    please

  12. #12
    Super Contributor
    Join Date
    Nov 2009
    Location
    Minnesota, USA
    Posts
    3,209

    Re: compile errors

    You've got names defined as both signals and actual methods. A signal is a fake method that should not have an actual implementation -- the implementation is in the moc module.

  13. #13
    Registered User
    Join Date
    May 2009
    Location
    Guatemala
    Posts
    186

    Re: compile errors

    Right !

    If readSMS is a signal, you don't need this:

    Code:
    void MessageWidget::readSMS(QListWidgetItem*)
    {
    }
    -CarlosDL

  14. #14
    Registered User
    Join Date
    Aug 2008
    Posts
    71

    Re: compile errors

    Thanks to all of you very very much !!!
    I have solved the problem !!!

Similar Threads

  1. Compile errors on Python Lib
    By pavc in forum Symbian
    Replies: 3
    Last Post: 2009-09-27, 11:30
  2. How do I view .rss compile errors
    By mribble in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 5
    Last Post: 2006-10-12, 15:33
  3. Tracking down compile errors in .NET ??!?
    By specjones in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2005-08-18, 07:56
  4. helloworldbasic compile errors
    By rich_b in forum Symbian Tools & SDKs
    Replies: 3
    Last Post: 2004-08-02, 08:43

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×