DEV-C++ 和 QT4 合拍
2007-11-11 09:20
330 查看
导读:
DEV-C++ 5 一个很不错的免费 C/C++ IDE。QT4 也是很不错的 UI 库。不知道是不是他们前世有什么仇,并不是那么合拍。Dev-C++的Makefile.win 不适合 QT4 的编译情况。而使用 qmake 生成的 makefile.release 才非常合适。
一、下载和安装 这步骤就不多说了,只留下下载的地址就好了。
DEV-C++ 下载地址:http://sourceforge.net/projects/dev-cpp/
QT4.2.3 下载地址:http://www.trolltech.com/products/qt/downloads
二、配置 1、配置编译器选项 在 devcpp.ini 增加以下的内容
[CompilerSets_2]
gcc.exe=gcc.exe
g++.exe=g++.exe
gdb.exe=gdb.exe
make.exe=mingw32-make.exe
windres.exe=windres.exe
dllwrap.exe=dllwrap.exe
gprof.exe=gprof.exe
Options=1000001000000000000000cmdline=-O2 -O2 -frtti -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
LinkLine=-mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-s -Wl,-subsystem,windows
CompAdd=1LinkAdd=1Bins=C:/Cplus/Dev-Cpp/Bin;C:/Cplus/Qt423/bin
C=C:/Cplus/Dev-Cpp/include
Cpp=C:/Cplus/Dev-Cpp/lib/gcc/mingw32/3.4.2/include;C:/Cplus/Dev-Cpp/include/c++/3.4.2/backward;C:/Cplus/Dev-Cpp/include/c++/3.4.2/mingw32;C:/Cplus/Dev-Cpp/include/c++/3.4.2C:/Cplus/Dev-Cpp/include;C:/Cplus/Qt423/include/QtXml;C:/Cplus/Qt423/include;C:/Cplus/Qt423/include/Qt;C:/Cplus/Qt423/include/QtCore;C:/Cplus/Qt423/include/QtGui;C:/Cplus/Qt423/mkspecs/win32-g++C:/Cplus/Qt423/include/QtSql
Lib=C:/Cplus/Dev-Cpp/lib;C:/Cplus/Qt423/lib
[CompilerSets]
2=GCC MingW32 - QT4.2.3
[ExternalPrograms]
Dummy=0
[ExternalPrograms.Programs]
.ui=C:/Cplus/Qt423/bin/designer.exe
2、创建 template 首先,在%DEVCPP_ROOT%/template 创建 QTApp.template ,文件的内容如下:
[Template]
ver=1
Name=QT Application
Icon=Qt.ico
Description=This is a QT Application project.
Catagory=QT
[Unit0]
CppName=main.cpp
Cpp=Qt4.txt
[Project]
UnitCount=1
Type=1
IsCpp=1
Compiler=
CppCompiler=-DWIN32_@@__@@__@@_
Linker=-lmingw32 -lqtmain -lQtCore4 -lQtGui4_@@__@@__@@_
CompilerSettings=1000001000000000000000
CompilerSet=2
IncludeVersionInfo=0
SupportXPThemes=0
Includes=C:/Cplus/Qt423/mkspecs/win32-g++;C:/Cplus/Qt423/include
Libs=C:/Cplus/Qt423/lib
ResourceIncludes=
Name=QT Application project
ProjectIcon=QT Application.project.ico
MakeIncludes=QT_UIMake.mak
UseCustomMakefile=1
CustomMakefile=Makefile.Release
ExeOutput=release
ObjectOutput=release
相同的目录,再创建 Qt4.txt ,文件的内容如:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
#include
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
#include
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
int main(int argc, char *argv[])
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
QApplication app(argc, argv);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
QPushButton hello("Hello world!");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
hello.resize(100, 30);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
hello.show();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return app.exec();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
需要说明的是,模板的文件(qt4.txt)可以自己根据 .template 来扩展。
三、创建工程、测试 创建工程,选择 QT 页下面的 QT Application 。 设定工程的属性:
1、工程类型,根据实际情况修改
2、Build选项中,输出改为 release
3、MakeFile 中,修改为 makefile.release
4、使用 qmake 生成 makefile.release , qmake -project qmake 如果工程非常小、没有自定义的对象,不用修改makefile和输出目录。
至此,完成了安装、配置。可以放心使用了。
本文转自
http://blog.csdn.net/cangwu_lee/archive/2007/05/21/1619270.aspx
DEV-C++ 5 一个很不错的免费 C/C++ IDE。QT4 也是很不错的 UI 库。不知道是不是他们前世有什么仇,并不是那么合拍。Dev-C++的Makefile.win 不适合 QT4 的编译情况。而使用 qmake 生成的 makefile.release 才非常合适。
一、下载和安装 这步骤就不多说了,只留下下载的地址就好了。
DEV-C++ 下载地址:http://sourceforge.net/projects/dev-cpp/
QT4.2.3 下载地址:http://www.trolltech.com/products/qt/downloads
二、配置 1、配置编译器选项 在 devcpp.ini 增加以下的内容
[CompilerSets_2]
gcc.exe=gcc.exe
g++.exe=g++.exe
gdb.exe=gdb.exe
make.exe=mingw32-make.exe
windres.exe=windres.exe
dllwrap.exe=dllwrap.exe
gprof.exe=gprof.exe
Options=1000001000000000000000cmdline=-O2 -O2 -frtti -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN
LinkLine=-mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-s -Wl,-subsystem,windows
CompAdd=1LinkAdd=1Bins=C:/Cplus/Dev-Cpp/Bin;C:/Cplus/Qt423/bin
C=C:/Cplus/Dev-Cpp/include
Cpp=C:/Cplus/Dev-Cpp/lib/gcc/mingw32/3.4.2/include;C:/Cplus/Dev-Cpp/include/c++/3.4.2/backward;C:/Cplus/Dev-Cpp/include/c++/3.4.2/mingw32;C:/Cplus/Dev-Cpp/include/c++/3.4.2C:/Cplus/Dev-Cpp/include;C:/Cplus/Qt423/include/QtXml;C:/Cplus/Qt423/include;C:/Cplus/Qt423/include/Qt;C:/Cplus/Qt423/include/QtCore;C:/Cplus/Qt423/include/QtGui;C:/Cplus/Qt423/mkspecs/win32-g++C:/Cplus/Qt423/include/QtSql
Lib=C:/Cplus/Dev-Cpp/lib;C:/Cplus/Qt423/lib
[CompilerSets]
2=GCC MingW32 - QT4.2.3
[ExternalPrograms]
Dummy=0
[ExternalPrograms.Programs]
.ui=C:/Cplus/Qt423/bin/designer.exe
2、创建 template 首先,在%DEVCPP_ROOT%/template 创建 QTApp.template ,文件的内容如下:
[Template]
ver=1
Name=QT Application
Icon=Qt.ico
Description=This is a QT Application project.
Catagory=QT
[Unit0]
CppName=main.cpp
Cpp=Qt4.txt
[Project]
UnitCount=1
Type=1
IsCpp=1
Compiler=
CppCompiler=-DWIN32_@@__@@__@@_
Linker=-lmingw32 -lqtmain -lQtCore4 -lQtGui4_@@__@@__@@_
CompilerSettings=1000001000000000000000
CompilerSet=2
IncludeVersionInfo=0
SupportXPThemes=0
Includes=C:/Cplus/Qt423/mkspecs/win32-g++;C:/Cplus/Qt423/include
Libs=C:/Cplus/Qt423/lib
ResourceIncludes=
Name=QT Application project
ProjectIcon=QT Application.project.ico
MakeIncludes=QT_UIMake.mak
UseCustomMakefile=1
CustomMakefile=Makefile.Release
ExeOutput=release
ObjectOutput=release
相同的目录,再创建 Qt4.txt ,文件的内容如:
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
#include
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
#include
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
int main(int argc, char *argv[])
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
QApplication app(argc, argv);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
QPushButton hello("Hello world!");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
hello.resize(100, 30);
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
hello.show();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return app.exec();
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
需要说明的是,模板的文件(qt4.txt)可以自己根据 .template 来扩展。
三、创建工程、测试 创建工程,选择 QT 页下面的 QT Application 。 设定工程的属性:
1、工程类型,根据实际情况修改
2、Build选项中,输出改为 release
3、MakeFile 中,修改为 makefile.release
4、使用 qmake 生成 makefile.release , qmake -project qmake 如果工程非常小、没有自定义的对象,不用修改makefile和输出目录。
至此,完成了安装、配置。可以放心使用了。
本文转自
http://blog.csdn.net/cangwu_lee/archive/2007/05/21/1619270.aspx
相关文章推荐
- DEV-C++ 和 QT4 合拍 - 小橙子的第一播 - CSDNBlog
- DEV-C++ 和 QT4 合拍
- C++编译器及IDE(Dev_C++、WxDev_C++、VC等)
- VB和Dev-C++合作——手把手教你写GUI程序
- dev -c++ 快捷键
- Qt 5.7.0 编译Android 纯C++ 程序 支持C++11
- C++/GUI/Qt学习——如何在Console中使用cin、cout、cerr
- C++(qt)游戏实战项目:坦克大战(前言)
- Windows下基于Qt用c++实现ping
- C++(qt)游戏实战项目:坦克大战(一)
- Windows下qt的环境配置及运行一个c++"hello world"实例详细步骤
- qt 调用 c++ dll 返回char* 乱码问题
- Qt & C++变量类型装换
- QT,C++多项式计算器—version3(厌倦CMD黑框框的走起!)
- 乱谈Qt程序之i18n的实现(从C++到Qt)
- 使用eclipse+DevC++完成JNI调用(2)
- C++与QT学习路线
- C++/Qt vs Java
- 从 相对路径 说开来(从C++到Qt)
- DEV-C++ 修改栈空间命令