# How to change the language standard to c++17

**URL:** <https://forums.unrealengine.com/t/how-to-change-the-language-standard-to-c-17/1256713>\
**Category:** C++\
**Tags:** project-settings, unreal-engine, CPP\
**Created:** [August 10, 2023, 11:43am UTC](https://forums.unrealengine.com/t/how-to-change-the-language-standard-to-c-17/1256713 "2023-08-10T11:43:29Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AzureStrannik](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/azurestrannik/32/911180_2.png) [@AzureStrannik](https://forums.unrealengine.com/u/AzureStrannik)\
**Post date:** [August 10, 2023, 11:43am UTC](https://forums.unrealengine.com/t/how-to-change-the-language-standard-to-c-17/1256713/1 "2023-08-10T11:43:29Z")

</div>

The problem I encountered is related to the fact that unreal engine 4.27 uses c++14 by default and filesystem was added in the c++17 standard. Since I don’t want to change the standard library to boost, I’m trying to update the c++ standard to c++17 in my project on unreal engine 4.27. But everywhere it says about CMakeLists.txt and Build.bat which I don’t have. when opening the properties of the file with the name of my project in visual studio and changing the text in the most similar line “nmake/additional parameters” from /std:c++14 to /std:c++17, the error C2039 “filesystem is not a member of std” did not disappear. most likely, the language standard is changed somewhere in the project settings inside Unreal Editor, but I couldn’t find it. just in case, I’ll say right away that I have declared the library #include . and I will attach the code of the function that the compiler swears at.  
function code:  
`void ASubReader::CreateDirect(FString Path, int& Out) { string route(TCHAR_TO_UTF8(*Path)); std::filesystem::path Folder(route);`

```
if (!std::filesystem::exists(Folder)) { // Проверка, существует ли уже папка с таким путем
	if (std::filesystem::create_directory(Folder)) { // Создание папки
		Out = 0;
	}
	else {
		Out = 1;
	}
}
else {
	Out = 2;
}

```

}  
init code:  
`UFUNCTION(BlueprintCallable) void CreateDirect(FString Path, int& Out);`

---

<div class="post-metadata">

**Author:** ![gardian206](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gardian206](https://forums.unrealengine.com/u/gardian206)\
**Post date:** [August 10, 2023, 5:57pm UTC](https://forums.unrealengine.com/t/how-to-change-the-language-standard-to-c-17/1256713/2 "2023-08-10T17:57:30Z")

</div>

are you compiling from source?  
there should be checks in the Compilation Tool Chain that check for the C++ version, so the checks that call out C++14 or older would be in there.

If you are using the installed engine then your out of luck and will probably need to migrate your project to a newer engine version to get the library changes.

the other option would be to find something similar to `<std::Filesystem>` for C++14 and append that to the engine.

though if your trying to just do fileIO then are you sure that the existing functionality doesn’t already work:

- `FFileHelper` gives Read/Write using byte arrays
- `FFileHandle` Read/Write of Binaries
- `TTextFileHelper` Read/Write of “text” files
- `FJsonObject`holding and working with JSON
- `TPlatformFile` interface for “platform-independent” that abstract file system

all of these are available in 4.27 already.

---

<div class="post-metadata">

**Author:** ![AzureStrannik](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/azurestrannik/32/911180_2.png) [@AzureStrannik](https://forums.unrealengine.com/u/AzureStrannik)\
**Post date:** [August 11, 2023, 3:36pm UTC](https://forums.unrealengine.com/t/how-to-change-the-language-standard-to-c-17/1256713/3 "2023-08-11T15:36:58Z")

</div>

according to what this code gave me

> #if \_\_cplusplus \>= 202002L  
> Out = 20;  
> #elif \_\_cplusplus \>= 201703L  
> Out = 17;  
> #elif \_\_cplusplus \>= 201402L  
> Out = 14;  
> #elif \_\_cplusplus \>= 201103L  
> Out = 11;  
> #elif \_\_cplusplus \>= 199711L  
> Out = 98;  
> #else  
> Out = 1611;  
> #endif

my c++ version is older than the 2011 version. I will try to find another universal library for creating folders

---

<div class="post-metadata">

**Author:** ![gardian206](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@gardian206](https://forums.unrealengine.com/u/gardian206)\
**Post date:** [August 11, 2023, 4:41pm UTC](https://forums.unrealengine.com/t/how-to-change-the-language-standard-to-c-17/1256713/4 "2023-08-11T16:41:25Z")

</div>

if you want to make sure a Folder path exists then use `FPath`  
if you want to potentially create a folder then look into `PlatformFileManager`

if the folder is going to be in your games directory then you can mark the folder as an asset for the asset manager, and then have it included in the Cooking process.

these are things that have been “needed” since UDK 3 days so they still exist in the engine. they just might not be using parts of the Standard Library to do it.

be mindful that if you are targeting console you may fail certification if for creating files outside of your directory, and mobile has its own storage concerns.

---

<div class="post-metadata">

**Author:** ![AzureStrannik](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/azurestrannik/32/911180_2.png) [@AzureStrannik](https://forums.unrealengine.com/u/AzureStrannik)\
**Post date:** [August 12, 2023, 2:34pm UTC](https://forums.unrealengine.com/t/how-to-change-the-language-standard-to-c-17/1256713/5 "2023-08-12T14:34:10Z")

</div>

> [@AzureStrannik](#):
>
> cplusplus

the solution was found by my friend on the Internet on [this site](https://gamedev.stackexchange.com/questions/184017/how-to-set-c-language-standard-for-vs2019-in-an-unreal-project). if you add a line

```
CppStandard = CppStandardVersion.Cpp17;

```

to the `"projectname".Build.cs`, the library starts working, but this does not affect the version of the standard itself and is not displayed in the function cplusplus

my Build.cs file after adding the line

```
// Fill out your copyright notice in the Description page of Project Settings.

using UnrealBuildTool;

public class GpsTestV2 : ModuleRules
{
public GpsTestV2(ReadOnlyTargetRules Target) : base(Target)
{
	CppStandard = CppStandardVersion.Cpp17;

	PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs;

	PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore" });

	PrivateDependencyModuleNames.AddRange(new string[] { });

	// Uncomment if you are using Slate UI
	// PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });

	// Uncomment if you are using online features
	// PrivateDependencyModuleNames.Add("OnlineSubsystem");

	// To include OnlineSubsystemSteam, add it to the plugins section in your uproject file with the Enabled attribute set to true

}
}

```
