【问题标题】:Error including header files in Unreal在虚幻引擎中包含头文件时出错
【发布时间】:2015-04-16 12:38:55
【问题描述】:

我是 Unreal 的新手,我在 Unreal 中有这个项目。我添加了几个新的 cpp 文件,其中包括一些标准头文件,如 string.h、stdlib 等。Intellisense 不会给出错误,但项目不会编译。 这是错误

Error 1 error : The first include statement in source file 'C:\<path>\Source\RoboRev_Win\Parser\Parser.cpp' is trying to include the file 'iostream' as the precompiled header, but that file could not be located in any of the module's include search paths. C:\<path>\Intermediate\ProjectFiles\EXEC RoboRev_Win

我什至尝试添加路径以包含项目属性下的目录但不使用。有人可以帮忙吗?

【问题讨论】:

    标签: unreal-engine4


    【解决方案1】:

    我刚刚遇到了这个问题,并通过确保公共项目标头是我所有文件的第一个包含语句来解决它:

    如果您的项目名称是 Foo,请确保您没有在该行上方包含任何内容 #include "Foo.h"

    【讨论】:

      【解决方案2】:

      确保在任何“YourFile.generated.h”语句之前包含标准头文件。

      还要确保使用正确的语法,例如

      #include <regex>
      

      而不是

      #include "regex"
      

      如果这没有帮助:

      • 也许贴上你的头文件代码?
      • 您能否将文件包含在其他 c++ 项目中而不会出错?
      • 如果不包含这些头文件,您的项目是否可以编译?

      【讨论】:

      • 我实际上是通过删除 cpp 文件并重新创建它们来解决它。它第二次起作用了。不过感谢您的帮助!
      猜你喜欢
      • 2017-11-17
      • 1970-01-01
      • 1970-01-01
      • 2014-08-03
      • 2018-08-13
      • 2016-03-02
      • 2021-03-02
      • 2018-08-16
      • 1970-01-01
      相关资源
      最近更新 更多