Eclipse与qt集成 [英] Eclipse integrate with qt

查看:598
本文介绍了Eclipse与qt集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用c ++ cdt下载qt和eclipse,我看到qt与qt ide(qt创建者)一起开发qt应用程序,这很好,但是我想这样做eclipse,我的意思是使用c + +代码与qt里面日食有没有 ?因为我正在尝试使用qt设计我的用户界面,并使用其他库中的其他代码来执行其他操作。



我尝试包含头文件(usr / include / qt4),但是当我编译这样的程序时,我仍然有一个问题(找不到qgui.h )任何帮助整合qt与eclipse像netbeans。



编辑:



这是我的输出

  13:48:48 ****增量构建调试项目测试**** 
信息:内部构建器用于构建
g ++ -o test src / test.o -lQtCore
src / test.o:在函数`main'中:
/media/sda2/workspaceeclipse/test/Debug/../src/test.cpp:6:未定义的引用`QApplication :: QApplication(int& char **,int)'
/media/sda2/workspaceeclipse/test/Debug/../src/test.cpp:8:未定义的引用`QPushButton :: QPushButton(QString const& QWidget *)'
/media/sda2/workspaceeclipse/test/Debug/../src/test.cpp:12:未定义的引用QApplication :: exec()'
/media/sda2/workspaceeclipse/test/Debug/../src/test.cpp:12:未定义的引用`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 :和$ QP $($)
/media/sda2/workspaceeclipse/test/Debug/../src/test.cpp:12:未定义的引用`QPushButton ::〜QPushButton()'
/media/sda2/workspaceeclipse/test/Debug/../src/test.cpp:12:未定义的引用QApplication ::〜QApplication()'
src / test.o:在函数中`QWidget :: resize(int,int)':
/usr/include/qt4/QtGui/qwidget.h:996:未定义的引用`QWidget :: resize(QSize const&)'
collect2 :错误:ld返回1退出状态

13:48:49构建完成(花费1s.609ms)


解决方案

我必须在项目属性=> C / C ++常规=>路径和符号中调整以下设置:



在包含选项卡上,对于GNU C ++语言,添加以下包含路径:




  • / usr / include / qt4

  • / usr / include / qt4 / QtCore

  • / usr / include / qt4 / QtGui



在符号标签中,对于GNU C ++语言,定义值为1的以下符号(可能与您不同,但至少需要QT_CC_GNU,QT_CORE_LIB和QT_GUI_LIB):



< $>
  • QT_CC_GNU

  • QT_CORE_LIB

  • QT_GUI_LIB

  • QT_NO_DEBUG

  • QT_SHARED

  • QT_TESTLIB_LIB

  • QT_WEBKIT



  • 通过这些设置,源索引器工作正常。除此之外,Eclipse只是为构建调用make。


    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)
    

    解决方案

    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.

    这篇关于Eclipse与qt集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆