Results 1 to 5 of 5

Thread: undefined reference to `compare::searchTwo(QString, QString, QString)'

  1. #1
    Join Date
    Jan 2008
    Location
    Vancouver, Canada
    Posts
    54
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default undefined reference to `compare::searchTwo(QString, QString, QString)'

    Hello, I am getting this error, (Linking error, according to what I have read), but I can't figure out how to fix it.

    Qt Code:
    1. RoboSearch.cpp: undefined reference to `compare::searchTwo(QString, QString, QString)'
    To copy to clipboard, switch view to plain text mode 

    Most people seem to have this trouble when they don't add the .cpp and .h in the .pro file, but I have. I am using Qt 4 on windows with VS C++ 2005 express, and am using VS to build the project.

    qmake –project
    qmake
    make clean
    make release

    This is the function in the class RoboSearch that is calling a method from another class.

    Qt Code:
    1. void RoboSearch::Compare()
    2. {
    3. compare *comp = new compare;
    4. comp->show();
    5. compare::searchTwo("B enrichment - MP - km2.xml", "B Enrichment MP 10-10-5.xml", directory);
    6. }
    To copy to clipboard, switch view to plain text mode 

    This is the class declartion of compare in compare.h
    Qt Code:
    1. class compare : public QMainWindow, private Ui::compare
    2. {
    3. Q_OBJECT
    4.  
    5. public:
    6. compare(QMainWindow *parent = 0);
    7. static void searchTwo(QString protocol1, QString protocol2, QString directory);
    8. };
    To copy to clipboard, switch view to plain text mode 

    And for good measure, here is the .pro file.


    Qt Code:
    1. TEMPLATE = app
    2. TARGET =
    3. DEPENDPATH += .
    4. INCLUDEPATH += .
    5. QT += xml
    6. CONFIG += console
    7. RC_FILE = RoboSearch.rc
    8.  
    9. # Input
    10. HEADERS += compare.h DOM.h readme.h RoboDOM.h RoboSearch.h
    11. FORMS += compare.ui readme.ui RoboSearch.ui
    12. SOURCES += compare.cpp DOM.cpp main.cpp readme.cpp RoboDOM.cpp RoboSearch.cpp
    13. RESOURCES += RoboSearch.qrc
    To copy to clipboard, switch view to plain text mode 

    I am new to Qt, and fairly new to programming in general.... Any idea what I'm doing wrong? Thanks!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: undefined reference to `compare::searchTwo(QString, QString, QString)'

    Where did you implement compare::searchTwo()?

  3. #3
    Join Date
    Jan 2008
    Location
    Vancouver, Canada
    Posts
    54
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: undefined reference to `compare::searchTwo(QString, QString, QString)'

    I implemented it in compare.cpp, which has #include <compare.h>. It doesn't do anything right now except return, because I took everything out to try to narrow this problem down.

  4. #4
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: undefined reference to `compare::searchTwo(QString, QString, QString)'

    May we see the implementation? Perhaps you forgot compare:: prefix?
    J-P Nurmi

  5. The following user says thank you to jpn for this useful post:

    abrou (31st January 2008)

  6. #5
    Join Date
    Jan 2008
    Location
    Vancouver, Canada
    Posts
    54
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: undefined reference to `compare::searchTwo(QString, QString, QString)'

    That is exactly what I forgot! thank you very much.

Similar Threads

  1. how to add static library into qmake
    By Namrata in forum Qt Tools
    Replies: 1
    Last Post: 20th November 2007, 18:33
  2. MS Sql native driver??
    By LordQt in forum Qt Programming
    Replies: 4
    Last Post: 9th October 2007, 14:41
  3. error undefined reference ...............
    By amit_pansuria in forum Qt Programming
    Replies: 2
    Last Post: 8th June 2007, 15:28
  4. Convert from iso-8859-1 to... Something else :-)
    By Nyphel in forum Qt Programming
    Replies: 4
    Last Post: 7th March 2007, 18:59
  5. how to correctly compile threads support?
    By srhlefty in forum Installation and Deployment
    Replies: 9
    Last Post: 25th June 2006, 20:15

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.