2020년 9월 16일 수요일

C++ - Get Variable Name (변수명 가져오기)

#include "stdafx.h"
#include <iostream>
#include <string>

using namespace std;

#define GET_NAME(n) #n

int main() {

	int StageNumber = 1000;
	string str = GET_NAME(StageNumber);
	cout << str << endl;
	return 0;
}
결과 출력 : "StageNumber"

2020년 9월 14일 월요일

ue4 - Exhausted all retries! (during create module)

결론부터 말하자면 - 모듈을 만들고 있는 와중에 모듈창을 켜놓고 빌드를해서 발생하게된 에러.


ex)

Build Error "Exhausted all retries!"

0

Good afternoon, I first encountered such a problem:

When I build a project, an error occurs: alt text

I start VS19 as an administrator

Product Version: UE 4.22
Tags:

Other User Comments - Visual studio can't write to EXEC because it is currently running. (But in general this error means that Visual studio can't modify some file)

UE4 (during create module) - LNK2019(ex "__declspec(dllimport) private: static class UClass * __cdecl UEditorStyle::Get()") Error To Build

결론부터 말하자면  -  빌드를 시작하기 전에 언리얼 에디터 모듈에 액세스해야합니다. PrivateDependencyModuleNames모듈의 코드베이스 내에서 사용할 수 있도록 이러한 종속성을 추가해야합니다. 

ex) LNK2019(ex "__declspec(dllimport) private: static class UClass * __cdecl UEditorStyle::Get()") 이러한 링크에러가 났다면 PrivateDependencyModuleNames"EditorStyle" 이 추가가 안되어 참조를 하지 못했던 것이다.


Preparing the MyCustomEditor module

Setting up the Build Rules

CustomAssetEditor.Build.cs

PrivateDependencyModuleNames.AddRange(
	new string[]
	{
        "Core",
        "CoreUObject",
        "Json",
        "Slate",
        "SlateCore",
        "Engine",
        "InputCore",
        "UnrealEd", // for FAssetEditorManager
        "KismetWidgets",
        "Kismet",  // for FWorkflowCentricApplication
        "PropertyEditor",
        "RenderCore",
        "ContentBrowser",
        "WorkspaceMenuStructure",
        "EditorStyle",
        "EditorWidgets",
        "Projects",
        "AssetRegistry",
        "Tutorial"
        
        // ... add private dependencies that you statically link with here ...	
	}
);

Before we can begin building our Custom Asset Editor, we need access to some Unreal Editor Modules. We add these dependencies to our PrivateDependencyModuleNames to make sure we are able to use them within our module's codebase.

CustomAssetEditor.Build.cs

PrivateIncludePathModuleNames.AddRange(
	new string[] 
	{
        "Settings",
        "IntroTutorials",
        "AssetTools",
        "LevelEditor"
    }
);

DynamicallyLoadedModuleNames.AddRange(
	new string[] 
	{
		"AssetTools"
	}
);

We will also add some module names to our PrivateIncludePathModuleNames and DynamicallyLoadedModuleNamesas we want to be able to easily access them in our code.


---------------------------------------------


PublicIncludePathModuleNames (List<String>)
List of modules names (no path needed) with header files that our module's public headers needs access to, but we don't need to "import" or link against.

PrivateIncludePathModuleNames (List<String>)
List of modules name (no path needed) with header files that our module's private code files needs access to, but we don't need to "import" or link against.


Question 1 ) "don't need to "import" or link against" This doesn't make sense, I asked other c++ developers with no Unreal knowledge, and they were confused too. What would I want to do with the module but import or link against? What should I include here then?

1. If you just want access to some header-only types (think template libraries for example), then you need the include paths set but don't need to link. So you add the module here instead of Public/PrivateDependencyModuleNames, since the latter creates a hard dependency. This use case is rare in UE4. However, you would also use these when you have dynamic dependencies - a lot of the editor modules in particular expose an interface that lets you use the functionality without static linking. In these cases, you add the module name to one of these two lists, and also to the DynamicallyLoadedModuleNames list.