2012-10-01 71 views
5

我下载QT与C++ CDT,我看到QT来使用Qt IDE(Qt Creator的),制定QT appliation和罚款,但我想这样做机智日食,我的意思是使用C++蚀整合在eclipse中使用qt编码。有没有 ?因为我正在尝试使用qt来设计我的用户界面,并使用其他库中的其他代码来执行其他操作。我试图包含头文件(usr/include/qt4),但我仍然有一个问题,当我编译这样的程序,我们(无法找到qgui.h)任何帮助像netbeans整合qt与eclipse。Eclipse中使用Qt

编辑:

这里是我的输出

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) 
+0

@ cmannett85:我不这么认为 - 如果没有QT eclipse插件,你可以很好地运行Eclipse作为Qt IDE。它需要一些设置工作,我认为这是OP卡住的地方。 –

+0

@Andreas我不认为有一个Eclipse设计师或语言学家的本地Eclipse等价物。 – cmannett85

+0

@ cmannett85 True - 但您可以将相应的文件类型分配给外部应用程序,以便您可以从项目树 –

回答

10

我不得不调整在 “项目属性=> C/C++通用=>路径和符号” 进行如下设置:

在GNU C++语言的“包含”选项卡中添加以下包含路径:

  • /usr/include/qt4
  • 的/ usr /包括/ QT4/QtCore
  • 的/ usr /包括/ 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”。

+0

中启动它们,谢谢您的回复,但是我得到此make:*** [sdg]错误1和未定义的引用到'QApplication ::〜QApplication()'和未定义的引用'QApplication :: exec()',最后一个错误是未定义的引用'QApplication :: QApplication(int&,char **,int)' – user1344201

+0

您是否正在使用qmake或者你在使用Eclipses内部构建系统?你使用哪个工具链? –

+0

我正在使用内部构建器,除了当我运行它时我没有错误,我得到“启动失败,找不到二进制文件” – user1344201