随笔 - 505  文章 - 1034  trackbacks - 0
<2008年11月>
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456


子曾经曰过:编程无他,唯手熟尔!

常用链接

留言簿(94)

随笔分类(649)

随笔档案(505)

相册

BCB

Crytek

  • crymod
  • Crytek's Offical Modding Portal

Game Industry

OGRE

other

Programmers

Qt

WOW Stuff

搜索

  •  

积分与排名

  • 积分 - 893946
  • 排名 - 14

最新随笔

最新评论

阅读排行榜

评论排行榜

如下面这个

examples\tutorial\t1

#include <QApplication>
#include 
<QPushButton>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    QPushButton hello(
"Hello world!");
    hello.resize(
10030);

    hello.show();
    
return app.exec();
}


2007-7-20:
    我用的是qt-win-eval-4.3.0-vs2003.exe,30天试用期。

开始 -> 所有程序 -> Qt by Trolltech v4.3.0 (Eval. VS2003) -> Qt 4.3.0 Command Prompt

用这个命令行的好处是它会配置环境:

Setting up a Qt environment...
-- QTDIR set to D:\Qt\4.3.0
-- Added D:\Qt\4.3.0\bin to PATH
-- QMAKESPEC set to win32-msvc.net
Setting environment for using Microsoft Visual Studio .NET 2003 tools.
(If you have another version of Visual Studio or Visual C++ installed and wish
to use its tools from the command line, run vcvars32.bat for that version.)
D:\Qt\4.3.0>

执行以下操作:

D:\Qt\4.3.0>cd examples\tutorial\t1

D:\Qt\4.3.0\examples\tutorial\t1>qmake

会生成3个makefile:

Makefile
Makefile.Debug
Makefile.Release

这些makefile 是根据t1.pro生成的,内容如下:

ps : 用惯了vs的集成环境,自己写个*.pro是不是会很痛苦?

TEMPLATE    = app
CONFIG        
+= qt warn_on
HEADERS        
=
SOURCES        
= main.cpp
TARGET        
= t1
QTDIR_build:REQUIRES
="contains(QT_CONFIG, small-config)"

# install
target.path 
= $$[QT_INSTALL_EXAMPLES]/tutorial/t1
sources.files 
= $$SOURCES $$HEADERS $$RESOURCES $$FORMS t1.pro
sources.path 
= $$[QT_INSTALL_EXAMPLES]/tutorial/t1
INSTALLS 
+= target sources



再执行以下操作,操作及效果如下:

D:\Qt\4.3.0\examples\tutorial\t1>nmake

Microsoft (R) 程序维护实用工具 7.10.3077 版
版权所有 (C) Microsoft Corporation。保留所有权利。

        nmake -f Makefile.Debug all

Microsoft (R) 程序维护实用工具 7.10.3077 版
版权所有 (C) Microsoft Corporation。保留所有权利。

        nmake -f Makefile.Release all

Microsoft (R) 程序维护实用工具 7.10.3077 版
版权所有 (C) Microsoft Corporation。保留所有权利。

呵呵,可以了


 

生成 *.pro

D:\Qt\4.3.0\practise_lai\HelloWorld>qmake -project

下面是生成的 HelloWorld.pro 文件:

######################################################################
# Automatically generated by qmake (2.01a) ??? ?? 21 02:55:38 2007
######################################################################

TEMPLATE = app
TARGET = 
DEPENDPATH += .
INCLUDEPATH += .

# Input
SOURCES += HelloWorld.cpp


 


 

生成Makefile

当你已经创建好你的项目文件,生成Makefile就很容易了,你所要做的就是先到你所生成的项目文件那里然后输入:

Makefile可以像这样由“.pro”文件生成:

    qmake -o Makefile hello.pro

对于Visual Studio的用户,qmake也可以生成“.dsp”文件,例如:

    qmake -t vcapp -o hello.dsp hello.pro
Q: 为什么我这样生成的*.dsp文件是损坏的?在vs2003里加不到解决方案里面







posted on 2007-07-20 05:01 七星重剑 阅读(1392) 评论(4)  编辑 收藏 引用 所属分类: PL--c/c++C++ lib -- Qt

FeedBack:
# re: 在vs2003中如何配置可以编译qt程序? 2007-07-20 10:22 小艾
早晨5点!!你是还没睡呢?还是已然早起了,不管哪个,佩服死了,我天天睡7个小时还老想赖床呢~~=。=!  回复  更多评论
  
# re: 在vs2003中如何配置可以编译qt程序? 2007-07-20 12:34 VeryDxZ
先qmake,再去读那个makefile应该就知道了~  回复  更多评论
  
# re: 在vs2003中如何配置可以编译qt程序? 2007-07-20 22:15 阿来
@小艾
搞了半晚上qt,hello world 都看不到,人世间最痛苦的莫过于此了! :(  回复  更多评论
  
# re: 在vs2003中如何配置可以编译qt程序? 2007-07-20 23:43 阿来
@VeryDxZ
谢谢提醒,看到hello world了

  回复  更多评论
  

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理