无法在 Windows 7 64 位上使用 stlsoft-1.9.124 编译 pantheios 1.0.0-beta216

Posted

技术标签:

【中文标题】无法在 Windows 7 64 位上使用 stlsoft-1.9.124 编译 pantheios 1.0.0-beta216【英文标题】:Unable to compile pantheios 1.0.0-beta216 with stlsoft-1.9.124 on windows 7 64bit 【发布时间】:2016-02-01 12:21:24 【问题描述】:

我在 Windows 7 64 位上使用 stlsoft-1.9.124 编译 pantheios 1.0.0-beta2016 时遇到问题。我遇到的第一个错误是

D:\Libraries\stlsoft-1.9.124\include\winstl/winstl.h(257) : fatal error C1189: #error :  Compiling with WIN64 defined and _WIN64 not defined. Are you using the wrong makefile?

我通过将makefile的第625行更改为:

OS_DEFS             =   -DWIN64 -D_WIN64

产生了这个新错误:

    cl    -nologo -c -W4 -WX  -O1 -MTd -D_DEBUG -Zi -Fd.\util.bailout.mt.debug.pdb    -DWIN64 -D_WIN64   -DSHWILD_QUALITY_NO_USE_XCOVER -DPANTHEIOS_NO_AUTO_INIT    -I..\..\include      -I"D:/Libraries/stlsoft-1.9.124\include"   -Fo.\util.bailout.mt.debug.obj ..\..\src\util\bailout.c
bailout.c
C:\Program Files (x86)\Windows Kits\8.1\include\shared\basetsd.h(180) : error C2220: warning treated as error - no 'object' file generated
C:\Program Files (x86)\Windows Kits\8.1\include\shared\basetsd.h(180) : warning C4305: 'type cast' : truncation from 'UINT_PTR' to 'void *'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\basetsd.h(190) : warning C4305: 'type cast' : truncation from 'INT_PTR' to 'void *'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\basetsd.h(255) : warning C4305: 'type cast' : truncation from 'INT_PTR' to 'void *'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\basetsd.h(265) : warning C4305: 'type cast' : truncation from 'UINT_PTR' to 'void *'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\basetsd.h(275) : warning C4305: 'type cast' : truncation from 'LONG_PTR' to 'void *'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\basetsd.h(285) : warning C4305: 'type cast' : truncation from 'ULONG_PTR' to 'void *'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\basetsd.h(299) : warning C4305: 'type cast' : truncation from 'ULONG_PTR' to 'void *'
C:\Program Files (x86)\Windows Kits\8.1\include\shared\basetsd.h(308) : warning C4305: 'type cast' : truncation from 'LONG_PTR' to 'void *'
C:\Program Files (x86)\Windows Kits\8.1\include\um\winnt.h(5842) : warning C4305: 'type cast' : truncation from 'ULONG_PTR' to 'PVOID *'
C:\Program Files (x86)\Windows Kits\8.1\include\um\winnt.h(5843) : warning C4305: 'type cast' : truncation from 'ULONG_PTR' to 'PVOID'
C:\Program Files (x86)\Windows Kits\8.1\include\um\winnt.h(8691) : warning C4305: 'type cast' : truncation from 'LONG64' to 'PVOID'
C:\Program Files (x86)\Windows Kits\8.1\include\um\winnt.h(8702) : warning C4305: 'type cast' : truncation from 'LONG64' to 'PVOID'
C:\Program Files (x86)\Windows Kits\8.1\include\um\winnt.h(8713) : warning C4305: 'type cast' : truncation from 'LONG64' to 'PVOID'
C:\Program Files (x86)\Windows Kits\8.1\include\um\winnt.h(19653) : warning C4305: 'type cast' : truncation from 'LONG_PTR' to '_ACTIVATION_CONTEXT *'
C:\Program Files (x86)\Windows Kits\8.1\include\um\winnt.h(19832) : warning C4305: 'type cast' : truncation from 'ULONG_PTR' to '_TEB *'
..\..\src\util\bailout.c(573) : warning C4305: 'type cast' : truncation from 'LONG_PTR' to 'HANDLE'
..\..\src\util\bailout.c(695) : warning C4305: 'type cast' : truncation from 'ULONG_PTR' to 'HKEY'
NMAKE : fatal error U1077: '"D:\Microsoft Visual Studio 12.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.

然后我更改了第 657 和 670 行以删除 -WX 编译器选项。

我仍然收到这些警告,但现在它继续编译(一遍又一遍地生成这些警告......)直到:

    cl    -nologo -c -W4 -wd4800 -wd4996     -EHsc -GR -MTd -D_DEBUG -Zi -Fd.\util.be_context.mt.debug.pdb    -DWIN64 -D_WIN64   -DSHWILD_QUALITY_NO_USE_XCOVER -DPANTHEIOS_NO_AUTO_INIT    -I..\..\include      -I"D:/Libraries/stlsoft-1.9.124\include"   -Fo.\util.be_context.mt.debug.obj ..\..\src\util\be.context.cpp
be.context.cpp
D:\Microsoft Visual Studio 12.0\VC\INCLUDE\crtdefs.h(494) : error C2371: 'size_t' : redefinition; different basic types predefined C++ types (compiler internal)(19) : see declaration of 'size_t'
D:\Libraries\pantheios-1.0.1-beta216\include\pantheios/internal/slice.hpp(110) : error C3861: 'size_t': identifier not found
D:\Microsoft Visual Studio 12.0\VC\INCLUDE\xstddef(282) : error C2338: This code is for 64-bit size_t.
D:\Microsoft Visual Studio 12.0\VC\INCLUDE\xstddef(283) : warning C4305: 'initializing' : truncation from 'unsigned __int64' to 'const size_t'
D:\Microsoft Visual Studio 12.0\VC\INCLUDE\xstddef(283) : warning C4309: 'initializing' : truncation of constant value
D:\Microsoft Visual Studio 12.0\VC\INCLUDE\xstddef(284) : warning C4305: 'initializing' : truncation from 'unsigned __int64' to 'const size_t'
D:\Microsoft Visual Studio 12.0\VC\INCLUDE\xstddef(284) : warning C4309: 'initializing' : truncation of constant value
D:\Microsoft Visual Studio 12.0\VC\INCLUDE\xstddef(300) : error C2338: This code is for 64-bit size_t.
D:\Microsoft Visual Studio 12.0\VC\INCLUDE\xstddef(301) : warning C4293: '>>' : shift count negative or too big, undefined behavior
D:\Microsoft Visual Studio 12.0\VC\INCLUDE\xutility(2906) : warning C4244: 'argument' : conversion from 'ptrdiff_t' to 'size_t', possible loss of data
..\..\src\util\be.context.cpp(386) : error C3861: 'size_t': identifier not found
NMAKE : fatal error U1077: '"D:\Microsoft Visual Studio 12.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.

我不知道该怎么办......

总结一下我的配置:

Windows 7 64bit,使用 \pantheios-1.0.1-beta216\build\vc12.x64\makefile 中的 makefile 进行编译 Visual Studio 12 (2013) pantheios 1.0.0-beta216 stlsoft-1.9.124(正确定义了 STLSOFT) nmake 编译之前执行 vcvarsall.bat

提前感谢您的帮助!

【问题讨论】:

【参考方案1】:

经过一番搜索,我发现调用的 cl 编译器实际上是为 x86 编译的。为了告诉 cl 为 64 位平台编译,我必须使用 'x64' 选项调用 vcvarsall.bat,它现在可以使用原始 makefile 正确编译!

干杯!

【讨论】:

以上是关于无法在 Windows 7 64 位上使用 stlsoft-1.9.124 编译 pantheios 1.0.0-beta216的主要内容,如果未能解决你的问题,请参考以下文章

无法在 Windows 7 64 位上安装 WebdriverIO Cucumber JS 框架

如何签署我的驱动程序以使其安装在 Windows 7 64 位上?

如何在 Windows 7 64 位上安装 PyOpenSSL?

无法启用 CURL - Windows 7 64 位上的 WAMP - PHP 5.3.13 Apache 2.2.22

在 Windows 7 64 位上安装 Android SDK:“找不到 JDK”? [复制]

在 Windows 7 64 位上安装 Eclipse 企业版时出错 [重复]