【问题标题】:C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(1545): error C2220: warning treated as error - no 'object' file generatedC:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(1545):错误 C2220:警告视为错误 - 未生成“对象”文件
【发布时间】:2016-12-15 19:47:09
【问题描述】:

当我从"Playing for Data" 论文构建 renderdoc 项目时,出现以下错误(作者对 VS13 没有问题,所以我想知道它是否可能是 VS15 问题):

1>------ Build started: Project: spirv, Configuration: Debug Win32 ------
2>------ Build started: Project: crash_generation_client, Configuration: Debug Win32 ------
3>------ Build started: Project: crash_generation_server, Configuration: Debug Win32 ------
4>------ Build started: Project: exception_handler, Configuration: Debug Win32 ------
1>  PpTokens.cpp
4>  exception_handler.cc
3>  client_info.cc
3>  minidump_generator.cc
3>  crash_generation_server.cc
2>  crash_generation_client.cc
2>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(1545): error C2220: warning treated as error - no 'object' file generated
3>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(1545): error C2220: warning treated as error - no 'object' file generated (compiling source file client_info.cc)
2>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(1545): warning C4091: 'typedef ': ignored on left of '' when no variable is declared
3>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(1545): error C2220: warning treated as error - no 'object' file generated (compiling source file minidump_generator.cc)
2>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(3191): warning C4091: 'typedef ': ignored on left of '' when no variable is declared
3>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(1545): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file client_info.cc)
3>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(1545): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file minidump_generator.cc)
3>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(3191): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file minidump_generator.cc)
3>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(3191): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file client_info.cc)
3>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(1545): error C2220: warning treated as error - no 'object' file generated (compiling source file crash_generation_server.cc)
3>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(1545): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file crash_generation_server.cc)
3>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(3191): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file crash_generation_server.cc)
4>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(1545): error C2220: warning treated as error - no 'object' file generated
4>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(1545): warning C4091: 'typedef ': ignored on left of '' when no variable is declared
4>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(3191): warning C4091: 'typedef ': ignored on left of '' when no variable is declared
1>..\..\..\3rdparty\glslang\glslang\MachineIndependent\preprocessor\PpTokens.cpp(218): error C2220: warning treated as error - no 'object' file generated
1>..\..\..\3rdparty\glslang\glslang\MachineIndependent\preprocessor\PpTokens.cpp(218): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\string.h(119): note: see declaration of 'strcpy'
1>..\..\..\3rdparty\glslang\glslang\MachineIndependent\preprocessor\PpTokens.cpp(223): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\string.h(119): note: see declaration of 'strcpy'
5>------ Build started: Project: renderdoc, Configuration: Debug Win32 ------
5>  core.cpp
5>  win32_callstack.cpp
5>  replay_renderer.cpp
5>  serialiser.cpp
5>serialise\serialiser.cpp(493): error C2220: warning treated as error - no 'object' file generated
5>serialise\serialiser.cpp(493): warning C4456: declaration of 'memoryBufEnd' hides previous local declaration
5>  serialise\serialiser.cpp(493): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings
5>  serialise\serialiser.cpp(446): note: see declaration of 'memoryBufEnd'
5>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(1545): error C2220: warning treated as error - no 'object' file generated (compiling source file os\win32\win32_callstack.cpp)
5>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(1545): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file os\win32\win32_callstack.cpp)
5>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(3191): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file os\win32\win32_callstack.cpp)
5>core\core.cpp(854): error C2220: warning treated as error - no 'object' file generated
5>core\core.cpp(854): warning C4456: declaration of 'it' hides previous local declaration
5>  core\core.cpp(854): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings
5>  core\core.cpp(839): note: see declaration of 'it'
5>replay\replay_renderer.cpp(49): fatal error C1083: Cannot open include file: 'ImfOutputFile.h': No such file or directory
========== Build: 0 succeeded, 5 failed, 6 up-to-date, 0 skipped ==========

这是我的一些截图:

我有 Windows 10 家庭版和 Visual Studio Enterprise 2015。

然后我将“将警告视为错误”选择为“否”,但仍然出现错误:

1>------ Build started: Project: spirv, Configuration: Debug Win32 ------
2>------ Build started: Project: crash_generation_client, Configuration: Debug Win32 ------
3>------ Build started: Project: crash_generation_server, Configuration: Debug Win32 ------
4>------ Build started: Project: exception_handler, Configuration: Debug Win32 ------
2>  crash_generation_client.cc
4>  exception_handler.cc
3>  client_info.cc
3>  minidump_generator.cc
3>  crash_generation_server.cc
1>  PpTokens.cpp
3>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(1545): error C2220: warning treated as error - no 'object' file generated (compiling source file client_info.cc)
3>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(1545): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file client_info.cc)
2>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(1545): error C2220: warning treated as error - no 'object' file generated
2>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(1545): warning C4091: 'typedef ': ignored on left of '' when no variable is declared
2>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(3191): warning C4091: 'typedef ': ignored on left of '' when no variable is declared
3>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(3191): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file client_info.cc)
3>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(1545): error C2220: warning treated as error - no 'object' file generated (compiling source file minidump_generator.cc)
3>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(1545): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file minidump_generator.cc)
3>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(3191): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file minidump_generator.cc)
3>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(1545): error C2220: warning treated as error - no 'object' file generated (compiling source file crash_generation_server.cc)
3>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(1545): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file crash_generation_server.cc)
3>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(3191): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file crash_generation_server.cc)
4>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(1545): error C2220: warning treated as error - no 'object' file generated
4>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(1545): warning C4091: 'typedef ': ignored on left of '' when no variable is declared
4>C:\Program Files (x86)\Windows Kits\8.1\Include\um\DbgHelp.h(3191): warning C4091: 'typedef ': ignored on left of '' when no variable is declared
1>..\..\..\3rdparty\glslang\glslang\MachineIndependent\preprocessor\PpTokens.cpp(218): error C2220: warning treated as error - no 'object' file generated
1>..\..\..\3rdparty\glslang\glslang\MachineIndependent\preprocessor\PpTokens.cpp(218): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\string.h(119): note: see declaration of 'strcpy'
1>..\..\..\3rdparty\glslang\glslang\MachineIndependent\preprocessor\PpTokens.cpp(223): warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
1>  C:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0\ucrt\string.h(119): note: see declaration of 'strcpy'
5>------ Build started: Project: renderdoc, Configuration: Debug Win32 ------
5>  core.cpp
5>  win32_callstack.cpp
5>  replay_renderer.cpp
5>  serialiser.cpp
5>serialise\serialiser.cpp(493): error C2220: warning treated as error - no 'object' file generated
5>serialise\serialiser.cpp(493): warning C4456: declaration of 'memoryBufEnd' hides previous local declaration
5>  serialise\serialiser.cpp(493): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings
5>  serialise\serialiser.cpp(446): note: see declaration of 'memoryBufEnd'
5>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(1545): error C2220: warning treated as error - no 'object' file generated (compiling source file os\win32\win32_callstack.cpp)
5>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(1545): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file os\win32\win32_callstack.cpp)
5>C:\Program Files (x86)\Windows Kits\8.1\Include\um\dbghelp.h(3191): warning C4091: 'typedef ': ignored on left of '' when no variable is declared (compiling source file os\win32\win32_callstack.cpp)
5>replay\replay_renderer.cpp(49): fatal error C1083: Cannot open include file: 'ImfOutputFile.h': No such file or directory
5>core\core.cpp(854): error C2220: warning treated as error - no 'object' file generated
5>core\core.cpp(854): warning C4456: declaration of 'it' hides previous local declaration
5>  core\core.cpp(854): note: to simplify migration, consider the temporary use of /Wv:18 flag with the version of the compiler with which you used to build without warnings
5>  core\core.cpp(839): note: see declaration of 'it'
========== Build: 0 succeeded, 5 failed, 6 up-to-date, 0 skipped ==========

将警告级别从 4 更改为 3 也是如此:

请提出解决方案。

具体来说,我从dbghelp.h 中的这部分代码中得到错误:

typedef enum {
    hdBase = 0, // root directory for dbghelp
    hdSym,      // where symbols are stored
    hdSrc,      // where source is stored
    hdMax       // end marker
};

   case PpAtomConstDouble:
        strcpy(ppToken->name, tokenText);
        ppToken->dval = atof(ppToken->name);
        break;

else if(header->version == SERIALISE_VERSION)
{
    const byte *memoryBufEnd = memoryBuf + length;

    memoryBuf += sizeof(FileHeader);

else
{
    auto it = m_WindowFrameCapturers.begin();
    // active window could be the first in our list, move
    // to second (we know from above there are at least 2)
    if(m_ActiveWindow == it->first)
        it++;
    m_ActiveWindow = it->first;
}



  Severity  Code    Description Project File    Line    Suppression State
    Error   C1083   Cannot open include file: 'ImfOutputFile.h': No such file or directory  renderdoc   D:\playing-for-data\renderdoc\renderdoc\replay\replay_renderer.cpp  49  


  #include <ImfOutputFile.h>

更新:我将解决方案重新定位到 10.0.14393.0(默认选择),清理并构建并得到相同的错误:

【问题讨论】:

  • 我认为您需要降低警告级别并且可以保持冷静
  • 喜欢到底在哪个级别?
  • 它完成了,我看到了。所以找到这个文件 h.并尝试发布 conf
  • 尝试将配置更改为发布。我敢打赌这无济于事,但有一些机会。然后谷歌解决方案。

标签: c visual-studio compiler-errors warnings


【解决方案1】:

dbghelp.h 的问题是对编码错误的真正警告。 typedef 名称需要一个变量。我相信您可能想从 Microsoft 更新您的库。

【讨论】:

    【解决方案2】:

    Visual Studio 解决方案包含 13 个 C++ 项目,所有这些项目都可能激活了“将警告视为错误”设置。尝试为所有项目禁用此选项并重新编译。

    【讨论】:

      猜你喜欢
      • 2013-08-16
      • 2017-11-08
      • 2023-03-03
      • 2014-05-10
      • 2019-02-04
      • 1970-01-01
      • 2016-12-19
      • 2014-08-28
      相关资源
      最近更新 更多