我正在 Windows 7 上的 Visual Studio 2015 中编译 NetHack。
我收到以下错误(均以c:\program files (x86)\windows kits\10\include\10.0.10586.0\um\memoryapi.h
:
3>(815): error C2143: syntax error: missing ')' before '.'
3>(815): error C2059: syntax error: ')'
3>(816): error C2059: syntax error: ')'
这是源代码中的上下文:
805 #if (_WIN32_WINNT >= _WIN32_WINNT_WIN10)
806
807 WINBASEAPI
808 _Ret_maybenull_ _Post_writable_byte_size_(Size)
809 PVOID
810 WINAPI
811 VirtualAllocFromApp(
812 _In_opt_ PVOID BaseAddress,
813 _In_ SIZE_T Size,
814 _In_ ULONG AllocationType,
815 _In_ ULONG Protection
816 );
这很令人困惑,因为#1,有一个编译器指令应该阻止这部分代码被使用——我正在运行 Windows 7,而#2,第一个错误,missing ')' before '.'
没有意义,因为.
源代码中没有代码。我该如何进行?
当我搜索_WIN32_WINNT
Visual Studio 的整个解决方案时,找不到它——太奇怪了!我确实找到了WINPFLAG = -DTILES -DMSWIN_GRAPHICS -DWIN32CON -D_WIN32_IE=0x0400 -D_WIN32_WINNT=0x0501
。但是,_WIN32_WINNT_WIN10
似乎没有定义,尽管它可能是由系统定义的(?)。尝试自己将其定义为 0x0A00,但取消注释上述代码再次产生相同的错误。
现在我得到Error C2733 'terminate': second C linkage of overloaded function not allowed NetHack nethack\include\extern.h 643
:
E void FDECL(terminate, (int)) NORETURN;
我用 Notepad++ 再次搜索了整个解决方案,这是唯一一次出现(奇怪的是,VS 本身仍然无法通过全局搜索找到这些东西)。