我知道这可能是gamedev的一个问题但是因为我在Visual Studio中遇到问题我把它放在这里。
首先,这里有2个源代码片段
代码块1
#pragma once
#include "Components/SceneComponent.h"
#include "CanonLauncher.generated.h"
UCLASS( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class BLOCKASSAULT_API UCanonLauncher : public USceneComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UCanonLauncher();
std::vector<int> canon;
// Called when the game starts
virtual void BeginPlay() override;
// Called every frame
virtual void TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction ) override;
int canonTime = 120;
canonTime = canonTime - 1;
};
代码块2
#pragma once
#include <vector>
#include <iostream>
#include "Components/SceneComponent.h"
#include "CanonLauncher.generated.h"
**UCLASS** ( ClassGroup=(Custom), meta=(BlueprintSpawnableComponent) )
class BLOCKASSAULT_API UCanonLauncher : public USceneComponent
{
GENERATED_BODY()
public:
// Sets default values for this component's properties
UCanonLauncher();
std::vector<int> canon;
// Called when the game starts
virtual void BeginPlay() override;
// Called every frame
virtual void TickComponent( float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction ) override;
int canonTime = 120;
canonTime = canonTime - 1;
};
第一个没有错误,但显然我的矢量代码不起作用,我的变量操作也不会。所以我添加了你看到的粗体位。现在变量操作,流量控制和向量工作但现在由双星号包围的位(&#34; **&#34;)抛出错误
此声明没有存储类或类型说明符
ADDENDUM 1:
是的,我知道iostream和vector正在与其中一个UE4标头创建代码冲突,这一点似乎很明显,我只是不知道如何解决它