用Eclipse(Version: 3.0.1)编译Qt的设置(qt-win-opensource-4.1.0-mingw.exe)
(1)安装Eclipse和CDT
(2)新建一个Managed Make C++ Project项目hello
(3)新增一个Source File main.cpp
#include <QtGui/QApplication>
#include <QtGui/QPushButton>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton hello("Hello world!");
hello.resize(100, 30);
hello.show();
return app.exec();
}
(4)在Project/Properties中选择C/C++ Build下的Tool Settings选项卡进行设置:
GCC C++ Compiler/Directories中浏览添加C:/Qt/4.1.0/include
GCC C++ Linker/Libraries中Libraries(-l)中添加QtCored4,QtGuid4,qtmaind
(注意不能写成libQtGuid4.a,libQtGuid4.a,libqtmaind.a)
Library search path(-L)中浏览添加C:/Qt/4.1.0/lib
(5)Run