如何使用 MSVC 2008 在 Windows 上使用 qtwebkit 构建 Qt5 - leveldb 找不到 stdint.h
Posted
技术标签:
【中文标题】如何使用 MSVC 2008 在 Windows 上使用 qtwebkit 构建 Qt5 - leveldb 找不到 stdint.h【英文标题】:how to build Qt5 with qtwebkit on Windows with MSVC 2008 - leveldb can't find stdint.h 【发布时间】:2015-02-02 17:04:59 【问题描述】:在 Windows 7 x64 机器上:
我安装了Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1 我从http://www.qt.io/download-open-source/# 的“源包和其他版本”部分下载并解压缩了 Qt5.4.0 源代码 我根据http://qt-project.org/wiki/Compiling-ICU-with-MSVC 从源代码构建了ICU 54.1
并安装了它。
我根据http://doc.qt.io/qt-5/windows-building.html 创建了一个命令提示符快捷方式。
我根据http://qt-project.org/wiki/Building_Qt_5_from_Git 和http://qt-project.org/wiki/Compiling-ICU-with-MSVC 的“用法”部分在命令提示符中添加了一些内容。
所以我的 qt5vars.cmd 是:
CALL "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat"
SET _ROOT=C:\qt\qt540
SET PATH=%_ROOT%\qtbase\bin;%_ROOT%\gnuwin32\bin;C:\Python27;C:\Python27\Scripts;%PATH%
REM Uncomment the below line when using a git checkout of the source repository
REM SET PATH=%_ROOT%\qtrepotools\bin;%PATH%
SET QMAKESPEC=win32-msvc2008
SET PATH=%PATH%;C:\icu\dist\lib;C:\Ruby193\bin
SET INCLUDE=%INCLUDE%;C:\icu\dist\include
SET LIB=%LIB%;C:\icu\dist\lib
SET _ROOT=
我根据Compiling Qt 5.3.2 + VS2008 + SDK7.1 error SHARDAPPIDINFOLINK 更新了qtwinextras\src\winextras\winshobjidl_p.h
。
根据https://groups.google.com/forum/#!topic/theano-users/JReP5_Ligu4 和C99 stdint.h header and MS Visual Studio,我在另一台机器上从C:\Program Files\Microsoft Visual Studio 10.0\VC\include
复制stdint.h
,并将其粘贴到C:\Qt\qt540\qtwebkit\Source\WTF\wtf
。我注释掉了WCHAR_MIN
的声明,并将修改后的stdint.h复制到c:\qt\qt540\qtwebkit\source\javascriptcore\runtime
。
通过上述设置,从上面的 qt5vars.cmd 提示符中,我将 Qt 配置为:
configure -prefix %CD%\qtbase -developer-build -opensource -opengl 桌面 -nomake 测试 -no-compile-examples -skip qtwebkit-examples -icu -plugin-sql-sqlite -platform win32-msvc2008 -confirm-license
然后运行nmake
。我得到一堆leveldb找不到stdint.h的错误:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\db/filename.h(10) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
c.cc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/c.h(50) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
dbformat.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
db_impl.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
db_iter.cc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\db/db_iter.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
filename.cc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\db/filename.h(10) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
log_reader.cc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\db/log_reader.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
log_writer.cc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\db/log_writer.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
memtable.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
repair.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
table_cache.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\db/table_cache.h(11) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
version_edit.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
version_set.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
write_batch.cc
C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\INCLUDE\xlocale(342) : warning C4530: C++ exception handler used, but unwind semantics are not enabled. Sp
ecify /EHsc
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\include\leveldb/db.h(8) : fatal error C1083: Cannot open include file: 'stdint.h': No such file or directory
Generating Code...
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\amd64\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '(' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'cd' : return code '0x2'
Stop.
C:\Qt\qt540\qtwebkit\Source\ThirdParty\leveldb\port\win
中有一个 stdint.h,但是将该文件或我修改后的 stdint.h 复制到 leveldb\db
和 leveldb\include\leveldb
没有区别 - 我在构建 Qt 时遇到相同的错误。
我需要做什么才能使用 Qt 构建 qtwebkit,或者至少解决这个 leveldb sdtint.h 问题?
【问题讨论】:
【参考方案1】:好吧,我是个假人。只需将stdint.h
复制到C:\Program Files\Microsoft Visual Studio 9.0\VC\include
而不是复制到每个抱怨的文件的路径。此外,我在 stdint.h 中注释掉了 WCHAR_MIN
的声明,以避免出现大量关于重新声明它的警告。
然后使用原题中的configure
语句,Qt5.4.0搭建成功,包括qtwebkit!花了 11 个小时来构建,但它成功了!
【讨论】:
以上是关于如何使用 MSVC 2008 在 Windows 上使用 qtwebkit 构建 Qt5 - leveldb 找不到 stdint.h的主要内容,如果未能解决你的问题,请参考以下文章
如何从用 MFC (MSVC 2008) 编写的应用程序查询基于 CGI 的网络服务器并处理结果?