❶ 讨论上Windows平台怎么编译Qt5
Qt5的编译官方有一篇wiki:http://developer.qt.nokia.com/wiki/Building_Qt_5_from_Git
简要的总结下我的体会,欢迎补充完善、批评指正。
1.First clone the top-level qt5 git repository:
git clone git://gitorious.org/qt/qt5.git qt5
这一行不用说了,自然是将Qt5的代码克隆。不过,如果你只是初次克隆Qt5的代码,会很惊讶:为何克隆后的代码只有十几MB?
原来,Qt5已经实现了Qt的模块化,详见:http://labs.qt.nokia.com/2011/05/12/qt-moles-maturity-level-the-list/
所以可以在克隆得到的Qt5源码根目录下看到:.gitmoles 文件,其内容部分摘录如下:
[submole "qtbase"]
path = qtbase
url = git://gitorious.org/qt/qtbase.git
[submole "qtsvg"]
path = qtsvg
url = git://gitorious.org/qt/qtsvg.git
[submole "qtdeclarative"]
path = qtdeclarative
url = git://gitorious.org/qt/qtdeclarative.git
...
这时,有Git基础的朋友一定会想到:
git submole init
git submole update
不过,请不要这样做!
2. Following the README file we initialize the repository. This clones the various sub-moles of Qt5:
./init-repository
这是一个perl脚本。如果是在msys-git下,会发现Perl的版本不够。
我们需要安装一个Windows版本的Perl:http://www.activestate.com/activeperl/downloads
安装好以后,Perl就添加到PATH环境变量中去了。
在MSVC的控制台下执行:
perl init-repository --help
注意,不是直接执行init-repository,要用perl来执行它。看看帮助:大致了解下有哪些功能。
3. 注意它的三个小提示:
Hint1: If you’re going to contribute to Qt 5, you’ll need to pass the —codereview-username <Jira/Gerrit username> option to set up a “gerrit” remote for all the sub-moles.
Hint2: If you’re having problems downloading the webkit repository (which is quite big), you can pass —no-webkit.
Hint3: If you’re behind a firewall, pass —http
4. 我的方法:
perl init-repository -f --codereview-username loaden
这样就可以实现子模块的批处理了。特别要注意的是:在处理这些子模块时,其实是git clone了这些子模块,以致于他们可以独立使用。在qt5\qtbase目录下可以找到.git目录。
这与git submole update的结果是不一样的!!
同时我使用了codereview的用户名,是为了可以创建一个名为gerrit的远程仓库,可以将贡献的代码推送进去,类似:
git push gerrit HEAD:refs/for/master
5. 源码下载是非常慢的,因为QtWebkit达到了1.7GB。源码下载完成后,进入Qt5源码目录,配置环境变量:
set PATH=%CD%\qtbase\bin;%PATH%
之后echo看一下结果是否正确:
echo %PATH%
6. 建议直接在Qt5的源码目录下执行配置!
configure -confirm-license -opensource -release -shared -platform win32-msvc2010 -fast -no-stl -no-qt3support -nomake examples -nomake demos -nomake tests
7. 编译全部模块,直接执行nmake就可以了。如果只编译一个模块,可以这样:
nmake mole-qtbase
双击打开Qt5目录下的Makefile文件,可以看到有这些模块:
SUBTARGETS = \
mole-qtbase \
mole-qtsvg \
mole-qtphonon \
mole-qtxmlpatterns \
mole-qtdeclarative \
mole-qttools \
mole-qttranslations \
mole-qtdoc \
mole-qlalr \
mole-qtqa \
mole-qtlocation \
mole-qtactiveqt \
mole-qtsensors \
mole-qtsystems \
mole-qtmultimedia \
mole-qtfeedback \
mole-qtquick3d \
mole-qtdocgallery \
mole-qtpim \
mole-qtconnectivity \
mole-qtwayland \
mole-qtjsondb \
sub-qtwebkit-pri \
mole-qtwebkit-examples-and-demos
❷ 大学初学c语言,用哪种c语言编译器能兼容win10系统
兼容win10系统的太多了,比如常用的vc++6.0,vs,甚至集成wingw的Qt都可以,不过学c语言最好的平台还是在linux上。
vc++6.0比较老了,虽然轻便但考虑到和win10的兼容性应该不太好。
vs是window世界最强大的c/c++开发工具,无论是编辑还是调试都非常人性化,而且还可以在官网下载社区版(正版且免费)。不过vs2015还是只能编译32位应用,另一个缺点是安装vs需要很大的磁盘空间和时间,我当初安装消耗了接近20G,时间花费了好几个小时(好吧我的网速比较慢电脑性能不好也许是个因素)。
Qt是跨平台的图形编辑器,你可以使用集成了wingw的qt编译windows程序,也可以使用windows上已经安装的编译器比如vs的编译器。其他诸如eclipse有没有集成编译器你可以自己查一下。
❸ 在linux下,QT怎样编译出windows程序
你好,1、可以安装cygwin,Cygwin是一个在windows平台上运行的类UNIX模拟环境,是cygnus solutions公司开发的自由软件,搜索官网下载即可,下载完成,安装的时候注意记得安装相关语言的编译器、解释器,在cygwin中生成Linux可执行文件。2、 可以安装vmware、virtualpc等虚拟机,在虚拟机里安装linux系统,然后在linux系统中编译相应的源码,生成linux上的可执行文件。