5

私はqtをダウンロードし、c ++ cdtでEclipseをダウンロードします。qtにはqt ide(qt Creator)が付属していて、qtアプリケーションを開発していることがわかりますが、これをwit eclipseで実行したいのですが、eclipse内でqtでc ++コードを使用することを意味します。ありますか?私はqtを使用してユーザーインターフェイスのみを設計し、他のライブラリの他のコードを使用して他のことをしようとしているためです。

ヘッダーファイル (usr/include/qt4) をインクルードしようとしましたが、プログラムをコンパイルするときにまだ問題があります (qgui.h が見つかりません)。qt を netbeans のような Eclipse と統合するのに役立ちます。

編集 :

ここに私の出力があります

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)
4

1 に答える 1

13

「Project Properties => C/C++ General => Paths and Symbols」で次の設定を調整する必要がありました。

[インクルード] タブで、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" を呼び出しています。

于 2012-10-01T09:51:45.087 に答える