首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >在没有编译任何源代码的情况下,MSVC会因编译器错误而失败

在没有编译任何源代码的情况下,MSVC会因编译器错误而失败
EN

Stack Overflow用户
提问于 2012-03-30 06:01:35
回答 2查看 2.4K关注 0票数 3

所有的源文件似乎都编译得很好。

然而,由于我做到了这一点,我得到了一个新的编译器错误:

代码语言:javascript
复制
1>------ Erstellen gestartet: Projekt: OpenLieroX, Konfiguration: Debug Win32 ------
1>Der Buildvorgang wurde am 29.03.2012 23:57:39 gestartet.
1>InitializeBuildStatus:
1>  Aktualisieren des Timestamps von "Debug\OpenLieroX.unsuccessfulbuild".
1>ClCompile:
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>  Alle Ausgaben sind aktuell.
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(54): warning RC4011: identifier truncated to '_CRT_SECURE_CPP_OVERLOAD_STANDA'
1>  
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\string.h(76): warning RC4011: identifier truncated to '_CRT_SECURE_CPP_OVERLOAD_SECURE'
1>  
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\yvals.h(367): warning RC4011: identifier truncated to '_DISABLE_DEPRECATE_STATIC_CPPLI'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/config/suffix.hpp(83): warning RC4011: identifier truncated to 'BOOST_NO_CV_VOID_SPECIALIZATION'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/config/suffix.hpp(92): warning RC4011: identifier truncated to 'BOOST_NO_LIMITS_COMPILE_TIME_CO'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/config/suffix.hpp(102): warning RC4011: identifier truncated to 'BOOST_NO_LONG_LONG_NUMERIC_LIMI'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/config/suffix.hpp(117): warning RC4011: identifier truncated to 'BOOST_NO_MS_INT64_NUMERIC_LIMIT'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/config/suffix.hpp(133): warning RC4011: identifier truncated to 'BOOST_NO_TEMPLATE_PARTIAL_SPECI'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/config/suffix.hpp(134): warning RC4011: identifier truncated to 'BOOST_BCB_PARTIAL_SPECIALIZATIO'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/config/suffix.hpp(141): warning RC4011: identifier truncated to 'BOOST_NO_TEMPLATE_PARTIAL_SPECI'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/config/suffix.hpp(142): warning RC4011: identifier truncated to 'BOOST_NO_ARRAY_TYPE_SPECIALIZAT'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/config/suffix.hpp(149): warning RC4011: identifier truncated to 'BOOST_NO_TEMPLATE_PARTIAL_SPECI'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/config/suffix.hpp(158): warning RC4011: identifier truncated to 'BOOST_NO_TEMPLATE_PARTIAL_SPECI'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/config/suffix.hpp(159): warning RC4011: identifier truncated to 'BOOST_NO_PARTIAL_SPECIALIZATION'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/config/suffix.hpp(169): warning RC4011: identifier truncated to 'BOOST_NO_TEMPLATED_ITERATOR_CON'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/config/suffix.hpp(186): warning RC4011: identifier truncated to 'BOOST_NO_ARGUMENT_DEPENDENT_LOO'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/config/suffix.hpp(186): warning RC4011: identifier truncated to 'BOOST_FUNCTION_SCOPE_USING_DECL'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/config/suffix.hpp(341): warning RC4011: identifier truncated to 'BOOST_NO_0X_HDR_INITIALIZER_LIS'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/config/suffix.hpp(344): warning RC4011: identifier truncated to 'BOOST_NO_0X_HDR_INITIALIZER_LIS'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/config/suffix.hpp(566): warning RC4011: identifier truncated to 'BOOST_NO_EXPLICIT_FUNCTION_TEMP'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/limits.hpp(22): warning RC4011: identifier truncated to 'BOOST_NO_LONG_LONG_NUMERIC_LIMI'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/limits.hpp(23): warning RC4011: identifier truncated to 'BOOST_NO_MS_INT64_NUMERIC_LIMIT'
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/cstdint.hpp(300): error RC2177: constant too big
1>  
1>C:\Program Files (x86)\boost\boost_1_47\boost/cstdint.hpp(300): fatal error RC1012: mismatched parenthesis : missing '
1>
1>Fehler beim Erstellen

我真的不明白为什么我会这样。也不是来自哪个源文件,因为它不再编译任何源代码(因为所有源代码都已成功编译)。

EN

Stack Overflow用户

发布于 2016-03-11 02:36:17

当尝试使用Visual Studio 2013编译Windows XP和POS Ready 2009作为目标时,我遇到了类似的问题。该应用程序使用Platform Toolset配置属性中的标准Visual Studio 2013 (v120)设置进行了很好的编译,但是,当更改为针对Windows XP的Visual Studio 2013 - Windows XP (v120_xp)时,我收到以下编译错误:

代码语言:javascript
复制
>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\winsock2.h(2752): fatal error RC10056:

跳转到WinSock2.h包含文件中的位置显示了一个使用__out_bcount_part_opt()宏的函数原型。

在看到这篇文章后,我意识到这个错误是一个资源编译器错误。进一步看,我发现源代码和资源文件中都包含一个包含WinSock2.h头文件的头文件piflocal.h

换句话说,应用程序源代码有一个头文件piflocal.h,它包含资源文件pif.rc以及C源文件使用的头文件resource.h所需的定义。piflocal.h中的一些定义需要来自微软标准头文件WinSock2.h的定义,因此WinSock2.h文件被#包含到piflocal.h中,从而使其可用。但是,当资源编译器作为拉入各种头文件的一部分,尝试将WinSock2.h文件作为处理piflocal.h的一部分进行处理时,它遇到了__out_bcount_part_opt()宏并失败了。

顺便说一句,__out_bcount_part_opt()宏是Header Annotations used in Windows headers的一部分。

标头注释描述函数如何使用其参数和返回值。这些批注已添加到许多Windows头文件中,以帮助您确保正确调用Windows API。如果启用代码分析(从Visual Studio 2005开始提供),如果您没有按照批注中描述的用法调用这些函数,则编译器将生成6000级警告。您还可以在自己的代码中添加这些注释,以确保正确调用它。若要在Visual Studio中启用代码分析,请参见适用于您的Visual Studio版本的文档。

这些注释是在Specstrings.h s.h中定义的。它们构建在原语之上,这些原语是标准注释语言( Standard Annotation Language,SAL)的一部分,并使用declspec("SAL*")实现。

然后,我对resource.hpiflocal.h头文件进行了必要的源代码更改,以便将piflocal.h中的pif.rc所需的少量定义移到resource.h中,并且在编译pif.rc时,资源编译器不再包含或拉入头文件piflocal.h

通过从资源编译器拉入的头文件列表中删除WinSock2.h,错误不再发生。

我不知道为什么它使用标准的Visual Studio 2013设置进行编译,并在针对Windows XP及其变体时失败。

结论:如果您遇到此错误或类似的错误,则很可能会将带有与资源编译器不兼容的宏定义的头文件包含到资源编译器中。

票数 2
EN
查看全部 2 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/9934221

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档