Results 1 to 5 of 5

Thread: errors

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default errors

    Alright so here is my simple code...

    header.cpp
    Qt Code:
    1. #include<QLabel>
    2. #include<QPushButton>
    3. #include<QVBoxLayout>
    4. #include<QCheckBox>
    5. #include<QLineEdit>
    6.  
    7. #include"header.h"
    8.  
    9.  
    10. widg::widg(QWidget *parent)
    11. : QWidget(parent)
    12. {
    13.  
    14. label = new QLabel(tr("Find What"));
    15. line = new QLineEdit;
    16. label->setBuddy(line);
    17.  
    18. close = new QPushButton(tr("Close"));
    19. close->resize(50,30);
    20.  
    21. find = new QPushButton(tr("Find"));
    22. find->resize(50,30);
    23. find->setEnabled(false);
    24. find->setDefault(true);
    25.  
    26. casechk = new QCheckBox(tr("Case Sensitive"));
    27. back = new QCheckBox(tr("Backward Search"));
    28.  
    29. connect(close,SIGNAL(clicked()),this,SLOT(quit()));
    30. connect(line,SIGNAL(textChanged(const QString &)),this,SLOT(enableFind(const QString &)));
    31. connect(find,SIGNAL(clicked()),this,SLOT(findClicked()));
    32.  
    33. lay->addWidget(label);
    34. lay->addWidget(line);
    35. lay->addWidget(casechk);
    36. lay->addWidget(back);
    37. lay->addWidget(find);
    38. lay->addWidget(close);
    39. setLayout(lay);
    40.  
    41. }
    42.  
    43. void widg::findClicked()
    44. {
    45. QString text = line->text();
    46.  
    47. Qt::CaseSensitivity ct = casechk->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive;
    48.  
    49. if(back->isChecked())
    50. {
    51. emit findprev(text, ct);
    52. }
    53. else
    54. {
    55. emit findnext(text, ct);
    56. }
    57. }
    58.  
    59. void widg::enableFind(const QString &text)
    60. {
    61. find->setEnabled(true);
    62. }
    To copy to clipboard, switch view to plain text mode 

    the header file

    Qt Code:
    1. #ifndef HEADER_H
    2. #define HEADER_H
    3.  
    4. #include<QWidget>
    5.  
    6. class QLabel;
    7. class QLineEdit;
    8. class QCheckBox;
    9.  
    10. class widg:public QWidget
    11. {
    12.  
    13. public:
    14.  
    15. widg(QWidget *parent = 0);
    16.  
    17. private slots:
    18.  
    19. void findClicked();
    20. void enableFind(const QString &text);
    21.  
    22. signals:
    23.  
    24. void findnext(const QString &str, Qt::CaseSensitivity cs);
    25. void findprev(const QString &str, Qt::CaseSensitivity cs);
    26.  
    27. private:
    28.  
    29. QLabel *label;
    30. QLineEdit *line;
    31. QPushButton *find;
    32. QPushButton *close;
    33. QCheckBox *casechk;
    34. QCheckBox *back;
    35. };
    36.  
    37. #endif
    To copy to clipboard, switch view to plain text mode 

    and the main
    Qt Code:
    1. #include<QApplication>
    2.  
    3.  
    4. #include"header.h"
    5.  
    6.  
    7. int main(int argc,char *argv[])
    8. {
    9. QApplication app(argc,argv);
    10.  
    11. widg widget;
    12. widget.show();
    13.  
    14. return app.exec();
    15. }
    To copy to clipboard, switch view to plain text mode 

    and i get the following error message
    Linking...
    header.obj : error LNK2001: unresolved external symbol "protected: void __thiscall widg::findnext(class QString const &,enum Qt::CaseSensitivity)" (?findnext@widg@@IAEXABVQString@@W4CaseSensitivity @Qt@@@Z)
    header.obj : error LNK2001: unresolved external symbol "protected: void __thiscall widg::findprev(class QString const &,enum Qt::CaseSensitivity)" (?findprev@widg@@IAEXABVQString@@W4CaseSensitivity @Qt@@@Z)
    release/r4.exe : fatal error LNK1120: 2 unresolved externals
    Error executing link.exe.

    r4.exe - 3 error(s), 0 warning(s)
    i don't know what to do..!! please help...!!
    Last edited by jpn; 14th June 2008 at 19:55. Reason: changed [quote] to [code] tags

Similar Threads

  1. Errors in building qtopia2.2
    By namita in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 5th June 2008, 07:57
  2. Ui class errors
    By calef13 in forum Qt Programming
    Replies: 2
    Last Post: 4th November 2007, 13:53
  3. Qt 4.1.0 - static examples run with errors!
    By Elder Orb in forum Qt Programming
    Replies: 1
    Last Post: 12th January 2006, 09:40

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.