KEEP K.I.S.S.

tk's blog

如何使用Qt Creator 开发普通C++项目

tk posted @ Jul 27, 2011 11:51:45 AM in 业余 with tags Qt Creator Qt , 6423 阅读

相信很多人有这样的需求吧

推荐使用 Qt Creator 2.1 以上版本,因为自带了 Class View ,不需要第三方的插件就可以看Symbol了。

新建项目里,选择 Other Project 然后是 Import Existing Project,建立项目后添加文件,最后需要的是自己写一个 Makefile, 而且默认的 Build 目标是 all,注意 GNU make 的文件格式,命令行开头需要一个完整的 TAB

针对最简单的单文件,比如 main.cpp ,makefile 可以这样写

 

all:
	g++ -o  main main.cpp          

然后就可以了。

如果你自己添加的第三方库也可以提供自动补全功能,但是需要能搜索到这个库目录,我用的是 Mingw ,直接把第三方库放到 Mingw 对应的 include 和 lib 目录了,引用头文件之后自动补全很好很强大。应该也有环境变量来设置的,不过暂时不大清楚如何操作。

jsimitseo 说:
Feb 01, 2024 09:06:50 PM

I am truly getting a charge out of perusing your elegantly composed articles. It would seem that you spend a considerable measure of exertion and time on your blog. I have bookmarked it and I am anticipating perusing new articles. Keep doing awesome.  concierge doctor


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter