Results 1 to 8 of 8

Thread: Eclipse error - method setupUi could not be resolved

  1. #1
    Join Date
    Jul 2011
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Eclipse error - method setupUi could not be resolved

    Hi
    I'm working on Eclipse IDE with qt4 plugin. Everythings work fine, all programs are compiling well, with no errors from compilator.
    But I have one very annoying error which comes from Eclipse IDE.
    syntax checker underlines ui.setupUi(this); with message: Method setupUi could not be resolved. This error have no matter for my application, and its work fine. but i cant stand to see the red underline in my project. I think that the problem is with my eclipse configuration.

    here is the class with that error:
    Qt Code:
    1. #include "qtmyapp.h"
    2.  
    3. QTMyApp::QTMyApp(QWidget *parent)
    4. : QWidget(parent)
    5. {
    6. ui.setupUi(this); // <-- here is the error
    7. }
    8.  
    9. QTMyApp::~QTMyApp()
    10. {
    11.  
    12. }
    13.  
    14. #include <QtGui/QWidget>
    15. #include "ui_qtmyapp.h"
    16.  
    17. class QTMyApp : public QWidget
    18. {
    19. Q_OBJECT
    20.  
    21. public:
    22. QTMyApp(QWidget *parent = 0);
    23. ~QTMyApp();
    24.  
    25. private:
    26. Ui::QTMyAppClass ui; //<-- and here
    27. };
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Eclipse error - method setupUi could not be resolved

    Try adding the directory where ui_*.h files are placed to eclipse indexer search paths.

  3. #3
    Join Date
    Jul 2011
    Posts
    8
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Eclipse error - method setupUi could not be resolved

    Hi
    thank you for reply, but I dont know what path are you mean.
    project include path?

  4. #4
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Eclipse error - method setupUi could not be resolved

    No, I mean in eclipse project settings. I don't have access to eclipse at the moment, so I can't tell you how to do that step-by-step. But try to search for something like "source paths", "include paths" or sth like that in project settings.

  5. #5
    Join Date
    Sep 2011
    Posts
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Eclipse error - method setupUi could not be resolved

    Hi,

    I had exactly the same error. I found this solution:

    1 - Go to your project's properties [alt+enter];
    2 - Go to left menu option C/C++ general->Indexer;
    3 - Check all check boxes (just like the picture).

    [IMG][/IMG]Captura_de_tela-Properties for testeqt .png

    That's it.

    Good luck.

  6. The following user says thank you to rafaelccomp for this useful post:

    lulu (28th November 2011)

  7. #6
    Join Date
    Oct 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Eclipse error - method setupUi could not be resolved

    If rafaelccomp's suggestion didn't fix it then this probably will:

    Check if you can find the ui_qtmyapp.h file in your project folder.

    If you can't then run the following command while in your project folder:

    <your_QT_Path>\bin\uic.exe qtmyapp.ui -o ui_qtmyapp.h

    you'll see a new file, refresh your eclipse project and enjoy

    (you still need what rafaelccomp suggested in addition to the above)

    Edit: Actually the real problem is that Eclipse can't find "make.exe" to build the project...and hence unable to execute that command in the makefile.

    As suggested by someone on another qt forum in 2008 > go to your mingw\bin folder and make a copy of mingw32-make.exe and rename that copy to make.exe

    build the project and you'll be fine!
    Last edited by CuriousCursor; 22nd October 2011 at 08:48.

  8. #7
    Join Date
    Sep 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Eclipse error - method setupUi could not be resolved

    Tanks a lot
    I had the same problem and solved .

  9. #8
    Join Date
    Oct 2012
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Eclipse error - method setupUi could not be resolved

    Quote Originally Posted by CuriousCursor View Post
    If rafaelccomp's suggestion didn't fix it then this probably will:

    Check if you can find the ui_qtmyapp.h file in your project folder.

    If you can't then run the following command while in your project folder:

    <your_QT_Path>\bin\uic.exe qtmyapp.ui -o ui_qtmyapp.h

    you'll see a new file, refresh your eclipse project and enjoy

    (you still need what rafaelccomp suggested in addition to the above)

    Edit: Actually the real problem is that Eclipse can't find "make.exe" to build the project...and hence unable to execute that command in the makefile.

    As suggested by someone on another qt forum in 2008 > go to your mingw\bin folder and make a copy of mingw32-make.exe and rename that copy to make.exe

    build the project and you'll be fine!
    I know this thread is a little old, but to add to this, you can also change the C/C++ Make Project make Build Command to mingw32-make

Similar Threads

  1. error calling method using connect
    By jeffmetal in forum Newbie
    Replies: 4
    Last Post: 22nd April 2010, 18:09
  2. Replies: 0
    Last Post: 31st December 2009, 09:31
  3. Eclipse gdb error
    By Doug Broadwell in forum Installation and Deployment
    Replies: 4
    Last Post: 14th April 2009, 08:18
  4. error in eclipse plug-in
    By sunote in forum Installation and Deployment
    Replies: 1
    Last Post: 15th November 2007, 19:38
  5. QT-Eclipse integration error
    By comlink21 in forum Qt Programming
    Replies: 1
    Last Post: 16th August 2007, 23:18

Tags for this Thread

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.