Qt with eclipse C++

  • Hi to all, im using C++ eclipse and make a simple GUI on Qt (Im using linux Tumbleweed). The GUI is a simple window with 2 buttons . I use the UIC file to generate a cpp file (header file) and then import that file into eclipse, also I added the Qt include folder into eclipse library path. Till here no problems, when I try to display the GUI on eclipse using this code inside main :

            Ui::MainWindow *dialog;
             QMainWindow w;
    	dialog = new Ui::MainWindow();

    this error is shown:

    undefined reference to `QMainWindow::QMainWindow(QWidget*, QFlagsQt::WindowType)'

    I have this includes :

    #include "QtWidgets/QApplication"
    #include "QtWidgets/QDialog"

    Im new in the Qt world. Also is possible to get a tutorial about eclipse C++ and Qt?
    Thanks in advance

  • Qt Champions 2018

    @GastonMelo said in Qt with eclipse C++:

    I added the Qt include folder into eclipse library path

    Do you mean to include path?
    The error message means that you're not linking against Qt libs.

  • hi jsulm,
    you are right, I add the Qt include folder to eclipse include path. Looking Qt library folder, do I need to add all those library to eclipse library?

  • I add Qt5Core Qt5Gui and Qt5Widgets and it works.

  • @GastonMelo if your issue is solved please don't forget to mark your post as such

  • When last I looked at the Qt plugin for eclipse it was hopelessly broken. At the time eclipse had a lot of problems parsing the Qt framework include files and MOC system for code checking. Are you using the plugin, or just using eclipse as an editor?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.