ber*_*luz 5 c include dosbox cstdint visual-studio-2015
当我尝试在 Windows 10 中编译 DOSBox SVN Daum 时,我遇到了 VS2015 中显然新出现的与标头相关的问题。示例:
Severity Code Description Project File Line Suppression State
Error (active) the global scope has no "int_least8_t" dosbox c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\cstdint 23
Error C2039 'int_least8_t': is not a member of '`global namespace'' dosbox C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\cstdint 23
Run Code Online (Sandbox Code Playgroud)
我的搜索告诉我,此类问题已经发生在周围的项目中,但我无法解决它。
特别是,我阅读了VisualStudio 2015 RC Issue with Includes和https://blogs.msdn.microsoft.com/vcblog/2015/03/03/introducing-the-universal-crt/,然后更改了 AppData\Local 的内容\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props 到:
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets">
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<IncludePath>D:\dev\include;$(UniversalCRT_IncludePath);$(IncludePath)</IncludePath>
<LibraryPath>D:\dev\lib;$(UniversalCRT_LibraryPath_x86);$(LibraryPath)</LibraryPath>
</PropertyGroup>
<ItemDefinitionGroup />
<ItemGroup />
</Project>
Run Code Online (Sandbox Code Playgroud)
但运气不好。:(
图片:

我距离成为一名经验丰富的 C 程序员还很远。谁能告诉我缺少什么吗?谢谢!
我在不同的程序中遇到了同样的问题,在查看了包含内容后,我终于解决了它。
如果您查看cstdint最近的 Visual Studio 中的典型文件,您会注意到其中一个包含文件是stdint.h. 这是各种类型的实际定义所在。所做cstdint的是将定义导出为std命名空间的成员。
然而,这里显示虽然第一行intXX_t编译得很好,但后面的行却编译int_least_xx_t不好。这是因为它读取了错误的stdint.h文件,该文件没有某些所需的定义。该文件是由那些想要在 MSVC 支持之前使用命名大小的人编写的(他们使用的是 C99,MSVC 从未真正抽出时间来支持,然后是 C++11,当时 MSVC 提供了支持)。
由于他们只需要确切的类型,因此他们没有编写其他类型的定义。既然MSVC支持了,就不需要这个兼容文件了。但是,由于项目文件未更新,编译器将找到错误的兼容性标头而不是正确的标头,从而导致此错误。
有两种方法可以解决此问题:更改包含文件夹顺序,以便获得您想要的文件,或者删除损坏的stdint.h文件。它很容易找到,因为您可以使用 Visual Studio 打开#include文件。对于您的情况,该文件位于src/platform/visualc/目录中。
附录:这是我的错误stdint.h文件
#pragma once
/* a minimal set of C99 types for use with MSVC */
typedef signed char int8_t;
typedef short int int16_t;
typedef int int32_t;
typedef __int64 int64_t;
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;
typedef unsigned __int64 uint64_t;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2176 次 |
| 最近记录: |