I try to parse some json string,but when I create a json object, The VS2017 report an error as follows.
This is my code.
cpp
#include "FloatingActor.h"
// Sets default values
AFloatingActor::AFloatingActor()
{
// Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
SaveData = MakeShareable(new FJsonObject());
}
// Called when the game starts or when spawned
void AFloatingActor::BeginPlay()
{
Super::BeginPlay();
}
// Called every frame
void AFloatingActor::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
}
.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "Json.h"
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "FloatingActor.generated.h"
UCLASS()
class CPP20180801_API AFloatingActor : public AActor
{
GENERATED_BODY()
public:
TSharedPtr<FJsonObject> SaveData;
public:
// Sets default values for this actor's properties
AFloatingActor();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
};
the error
1>------ 已启动生成: 项目: CPP20180801, 配置: Development_Editor x64 ------
1>Compiling game modules for hot reload
1>Parsing headers for CPP20180801Editor
1> Running UnrealHeaderTool "d:\Documents\Unreal Projects\CPP20180801\CPP20180801.uproject" "d:\Documents\Unreal Projects\CPP20180801\Intermediate\Build\Win64\CPP20180801Editor\Development\CPP20180801Editor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
1>Reflection code generated for CPP20180801Editor in 2.7276661 seconds
1>Performing 3 actions (15 in parallel)
1>FloatingActor.cpp
1>[2/3] Link UE4Editor-CPP20180801-9051.dll
1>[3/3] Link UE4Editor-CPP20180801-9051.lib
1> 正在创建库 d:\Documents\Unreal Projects\CPP20180801\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-CPP20180801-9051.lib 和对象 d:\Documents\Unreal Projects\CPP20180801\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-CPP20180801-9051.exp
1> 正在创建库 d:\Documents\Unreal Projects\CPP20180801\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-CPP20180801-9051.suppressed.lib 和对象 d:\Documents\Unreal Projects\CPP20180801\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-CPP20180801-9051.suppressed.exp
1>FloatingActor.cpp.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: __cdecl FJsonObject::FJsonObject(void)" (__imp_??0FJsonObject@@QEAA@XZ),该符号在函数 "public: __cdecl AFloatingActor::AFloatingActor(void)" (??0AFloatingActor@@QEAA@XZ) 中被引用
1>FloatingActor.cpp.obj : error LNK2019: 无法解析的外部符号 "__declspec(dllimport) public: __cdecl FJsonObject::~FJsonObject(void)" (__imp_??1FJsonObject@@QEAA@XZ),该符号在函数 "public: virtual void __cdecl SharedPointerInternals::TReferenceControllerWithDeleter<class FJsonObject,struct SharedPointerInternals::DefaultDeleter<class FJsonObject> >::DestroyObject(void)" (?DestroyObject@?$TReferenceControllerWithDeleter@VFJsonObject@@U?$DefaultDeleter@VFJsonObject@@@SharedPointerInternals@@@SharedPointerInternals@@UEAAXXZ) 中被引用
1>d:\Documents\Unreal Projects\CPP20180801\Binaries\Win64\UE4Editor-CPP20180801-9051.dll : fatal error LNK1120: 2 个无法解析的外部命令
1>ERROR : UBT error : Failed to produce item: d:\Documents\Unreal Projects\CPP20180801\Binaries\Win64\UE4Editor-CPP20180801-9051.dll
1>Total build time: 6.98 seconds (Local executor: 0.00 seconds)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: 命令“"C:\Program Files\Epic Games\UE_4.16\Engine\Build\BatchFiles\Build.bat" CPP20180801Editor Win64 Development "d:\Documents\Unreal Projects\CPP20180801\CPP20180801.uproject" -waitmutex”已退出,代码为 5。请验证您是否拥有运行此命令的足够权限。
1>已完成生成项目“CPP20180801.vcxproj”的操作 - 失败。
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
Can somebody help me with my error?
Thanks a lot.