UE4C++编译源码问题:#include “StatsViewer/Public/StatsViewerUtils.h“编译报错

  StatsViewerUtils.h(16): [C4430] missing type specifier - int assumed. Note: C++ does not support default-int
  StatsViewerUtils.h(16): [C2146] syntax error: missing ';' before identifier 'AActor'
  StatsViewerUtils.h(23): [C4430] missing type specifier - int assumed. Note: C++ does not support default-int
  StatsViewerUtils.h(23): [C2086] 'int StatsViewerUtils::STATSVIEWER_API': redefinition
  StatsViewerUtils.h(16): [C2086] see declaration of 'StatsViewerUtils::STATSVIEWER_API'
  StatsViewerUtils.h(23): [C2146] syntax error: missing ';' before identifier 'FText'

在这里插入图片描述

用的Rider在学习UE4官方文档的入门代码的时候,在一次编译里遇到了这个问题,但这个问题是来自于引擎源码,官方的引擎源码是设有简单的保护提示的,我肯定没改过源码,但这两API就是识别不了。

后来发现,是我的一个类的头文件里莫名其妙的引用了#include “StatsViewer/Public/StatsViewerUtils.h”
因为只有在引用了这个文件的情况下它才会进行编译并且报错,只有把include这的引用删掉就没事了。

这个文件的只两个函数GetActor和GetAssetName,有可能是Rider编译器在我写代码的时候自动给我引用了(最大的可能是习惯性写出了GetActor的时候导致的问题。)
其他文章里有说道怎么修改怎么报错,但是都是VS编译器的方法,RD我不知道怎么弄,就这样吧,能跑就行hh
如果有大佬能告诉我怎么办就最好了(

猜你喜欢

转载自blog.csdn.net/qq_18116643/article/details/126474492
今日推荐