Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse integrate with qt

Tags:

c++

eclipse

qt

i download qt and eclipse with c++ cdt , i see that qt come with qt ide (qt creator) , to develop qt appliation and that fine , but i want to do this wit eclipse , i mean use c++ code with qt inside eclipse . is there any ? because i am trying to use qt to design my user interface only and using other code from other libraries to do other things .

i try to include header files (usr/include/qt4) , but i still have a problem when i compile the program such us ( can't find qgui.h ) any help the integrate qt with eclipse like netbeans .

edit :

here is my output

13:48:48 **** Incremental Build of configuration Debug for project test ****
Info: Internal Builder is used for build
g++ -o test src/test.o -lQtCore 
src/test.o: In function `main':
/media/sda2/workspaceeclipse/test/Debug/../src/test.cpp:6: undefined reference to `QApplication::QApplication(int&, char**, int)'
/media/sda2/workspaceeclipse/test/Debug/../src/test.cpp:8: undefined reference to `QPushButton::QPushButton(QString const&, QWidget*)'
/media/sda2/workspaceeclipse/test/Debug/../src/test.cpp:12: undefined reference to `QApplication::exec()'
/media/sda2/workspaceeclipse/test/Debug/../src/test.cpp:12: undefined reference to `QPushButton::~QPushButton()'
/media/sda2/workspaceeclipse/test/Debug/../src/test.cpp:12: undefined reference to `QApplication::~QApplication()'
/media/sda2/workspaceeclipse/test/Debug/../src/test.cpp:8: undefined reference to `QPushButton::~QPushButton()'
/media/sda2/workspaceeclipse/test/Debug/../src/test.cpp:12: undefined reference to `QPushButton::~QPushButton()'
/media/sda2/workspaceeclipse/test/Debug/../src/test.cpp:12: undefined reference to `QApplication::~QApplication()'
src/test.o: In function `QWidget::resize(int, int)':
/usr/include/qt4/QtGui/qwidget.h:996: undefined reference to `QWidget::resize(QSize const&)'
collect2: error: ld returned 1 exit status

13:48:49 Build Finished (took 1s.609ms)
like image 643
user1344201 Avatar asked Oct 01 '12 09:10

user1344201


1 Answers

I had to adjust the following settings in "Project Properties => C/C++ General => Paths and Symbols":

On the "Includes" tab, for the GNU C++ language, add the following include paths:

  • /usr/include/qt4
  • /usr/include/qt4/QtCore
  • /usr/include/qt4/QtGui

On the "Symbols" tab, for the GNU C++ language, define the following symbols with a value of "1" (might be different for you, but at least the QT_CC_GNU, QT_CORE_LIB and QT_GUI_LIB are necessary):

  • QT_CC_GNU
  • QT_CORE_LIB
  • QT_GUI_LIB
  • QT_NO_DEBUG
  • QT_SHARED
  • QT_TESTLIB_LIB
  • QT_WEBKIT

With these settings, the source indexer works well. Other than that, Eclipse is simply calling "make" for the build.

like image 155
Andreas Fester Avatar answered Oct 11 '22 08:10

Andreas Fester