尝试在UE4函数库中包含一些标头时出现错误

时间:2019-12-09 00:42:39

标签: unreal-engine4

我需要在我的c ++库插件中包含向量和字符串库,这是我需要导入的代码所要求的。

问题在于,每次尝试包含它们时,“ GENERATED_UCLASS_BODY()”函数都会变为红色,并说“此声明没有存储类或类型说明符”,并且没有任何编译。

我需要的是包括这两个简单的库。

源代码:

PassGenBPLibrary.h


#pragma once

#include "Kismet/BlueprintFunctionLibrary.h"
#include <vector>
#include <string>
#include "PassGenBPLibrary.generated.h"

/* 
*   Function library class.
*   Each function in it is expected to be static and represents blueprint node that can be called in any blueprint.
*
*   When declaring function you can define metadata for the node. Key function specifiers will be BlueprintPure and BlueprintCallable.
*   BlueprintPure - means the function does not affect the owning object in any way and thus creates a node without Exec pins.
*   BlueprintCallable - makes a function which can be executed in Blueprints - Thus it has Exec pins.
*   DisplayName - full name of the node, shown when you mouse over the node and in the blueprint drop down menu.
*               Its lets you name the node using characters not allowed in C++ function names.
*   CompactNodeTitle - the word(s) that appear on the node.
*   Keywords -  the list of keywords that helps you to find node when you search for it using Blueprint drop-down menu. 
*               Good example is "Print String" node which you can find also by using keyword "log".
*   Category -  the category your node will be under in the Blueprint drop-down menu.
*
*   For more info on custom blueprint nodes visit documentation:
*   https://wiki.unrealengine.com/Custom_Blueprint_Node_Creation
*/
UCLASS()
class UPassGenBPLibrary : public UBlueprintFunctionLibrary
{
    GENERATED_UCLASS_BODY()

    static void CreateChr(std::vector<std::string>* Chr, const bool bUP, const bool bLow, const bool bNum, const bool bSYM);

    UFUNCTION(BlueprintCallable, meta = (DisplayName = "Generate password", Keywords = "PassGen password"), Category = "PassGen")
        static std::string CreatePw(const int Len, const bool bSafe, const unsigned int* Seed, const bool bUP, const bool bLow, const bool bNum, const bool bSYM);
};

PassGenBPLibrary.cpp


#include "PassGenBPLibrary.h"
#include "PassGen.h"
#include <random>
#include <vector>
#include <string>

std::string UPassGenBPLibrary::CreatePw(const int Len, const bool bSafe, const unsigned int* Seed, const bool bUP, const bool bLow, const bool bNum, const bool bSYM) { the function goes here }
void UPassGenBPLibrary::CreateChr(std::vector<std::string>* Chr, const bool bUP, const bool bLow, const bool bNum, const bool bSYM) { the function goes here }

0 个答案:

没有答案