【UE4 调试】C++ 常见编译 warnnings/errors

error LNK2019: unresolved external symbol “” referenced in function

  • 描述
    • Link错误、无法解析的外部符号
  • 解决方法
    • 检查.build.cs 中是否增加相关模块的引用,或者是否使用 XXX_API 宏

error C4668: “_WIN32_WINNT_WIN10_TH2”

  • 描述
    • UE4 error C4668: 没有将“_WIN32_WINNT_WIN10_TH2”定义为预处理器宏,用“0”替换“#if/#elif
    • #include <windows.h> 中的宏和UE4冲突所致
  • 解决方法
    使用如下头文件包裹<windows.h>头文件:
    #include "Windows/AllowWindowsPlatformTypes.h"
    #include "Windows/PreWindowsApi.h"
    #include <windows.h> //冲突头文件
    #include "Windows/PostWindowsApi.h"
    #include "Windows/HideWindowsPlatformTypes.h"
    
posted @ 2021-05-02 09:59  砥才人  阅读(801)  评论(0编辑  收藏  举报