MSVC fails with compiler errors without compiling any sources

旧城冷巷雨未停 提交于 2019-12-10 10:11:28

问题


All source files seem to have compiled fine.

However, since I achieved that, I am getting a new compiler error:

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

I don't really understand why I get that. And also not from what source file because it isn't compiling any sources anymore (because all have been compiled successfully).


回答1:


(Reposting from comment so question can be marked answered.)

You shouldn't be compiling normal code with the resource compiler.




回答2:


While the marked answer is already correct here some background: The MSVC Resource Compiler truncates macro names at char 31. Similar problems occur also with newer system headers like those from VC10 or later which have macro names defined with more than 31 chars. See also M$'s reply who call this simply 'by design' instead of fixing their RC.EXE:

http://connect.microsoft.com/VisualStudio/feedback/details/532929/rc4011-warnings-from-vc10-rc

Affected system headers with macro names greater than 31 chars are since VC10 string.h, tchar.h, wchar.h, yvals.h and probably some more ... see also:

http://social.msdn.microsoft.com/Forums/vstudio/en-US/ea289832-c48c-475b-a922-bf94d2ee54e4/vs2012-update-1-fatal-error-rc10056-in-c-project-when-v110xp-platform-is-chosen




回答3:


When attempting to use Visual Studio 2013 to compile for Windows XP and POS Ready 2009 as a target, I ran into a similar problem. The application compiled fine with the standard Visual Studio 2013 (v120) setting in the Platform Toolset Configuration Properties however when changed to Visual Studio 2013 - Windows XP (v120_xp) to target Windows XP, I received a compilation error of:

>C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\include\winsock2.h(2752): fatal error RC10056:

Jumping to the location in the WinSock2.h include file showed a function prototype which used the __out_bcount_part_opt() macro.

After seeing this posting I realized that the error was a resource compiler error. Looking further what I discovered was that a header file, piflocal.h, that was included in both the source code and the resource file contained an include of the WinSock2.h header file.

In other words the application source code had a header file, piflocal.h, which contained defines needed by the header file resource.h used by the resource file pif.rc as well as the C source files. Some of the definitions in piflocal.h required definitions from the Microsoft standard header file WinSock2.h so the WinSock2.h file was #included into piflocal.h making it available. However when the resource compiler, as part of pulling in the various header files, attempted to process the WinSock2.h file as a part of processing piflocal.h, it ran into the __out_bcount_part_opt() macro and failed.

The __out_bcount_part_opt() macro, by the way, is part of the Header Annotations used in Windows headers.

Header annotations describe how a function uses its parameters and return value. These annotations have been added to many of the Windows header files to help you ensure that you are calling the Windows API correctly. If you enable code analysis, which is available starting with the Visual Studio 2005, the compiler will produce level 6000 warnings if you are not calling these functions per the usage described through the annotations. You can also add these annotations in your own code to ensure that it is being called correctly. To enable code analysis in Visual Studio, see the documentation for your version of Visual Studio.

These annotations are defined in Specstrings.h. They are built on primitives that are part of the Standard Annotation Language (SAL) and implemented using declspec("SAL*").

I then made the necessary source code changes to the resource.h and the piflocal.h header files so that few defines needed by pif.rc from piflocal.h were moved into resource.h and the header file piflocal.h was no longer included or pulled in by the resource compiler when compiling pif.rc.

By removing WinSock2.h from the list of header files pulled in by the resource compiler, the error no longer happened.

I do not know why this compiled with the standard Visual Studio 2013 settings and failed with targeting Windows XP and its variants.

Conclusion: if you are running into this error or similar error, more than likely you are including into the resource compiler a header file with a macro definition which is incompatible with the resource compiler.



来源:https://stackoverflow.com/questions/9934221/msvc-fails-with-compiler-errors-without-compiling-any-sources

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!