错误包括Unreal中的头文件

时间:2015-02-16 03:13:11

标签: unreal-engine4

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

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

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

2 个答案:

答案 0 :(得分:2)

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

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

答案 1 :(得分:1)

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

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

#include <regex>

而不是

#include "regex"

如果这没有帮助:

  • 也许发布头文件代码的顶部?
  • 您是否能够在没有错误的情况下将文件包含在其他c ++项目中?
  • 如果您不包含这些标题,您的项目是否会编译?