How to use C++ Standard Library? (std)


I have a pure C++ code base of about 3000 lines of code. The code that I have written solely uses C++ Standard Library and nothing else.
However when I merged the source into my project I get errors like the following:

The solutions provided did not help.

I simply want to use the C++ standard library but I don’t know how.

I can provide code samples and “classes” that I’m using for this.

Thanks in advance,


you could try to surround the related include (for example <map> for std::map) with:

#include “AllowWindowsPlatformTypes.h”
#include <windows.h>
#include <map>
#include “HideWindowsPlatformTypes.h”

But I do not know why namespace std is not being found.
Perhaps the precompilier has problems to parse the related header.

Sometimes unrecognized keywords or chars at the beginning of the header or before the class declaration are resulting in those error outputs.


Sorry I’ve tried that solution before but it didn’t work.
This is so frustrating…

Hm, I am using several std classes without problems.

Can you compile a simple cpp file with for example:

in void FooFile.cpp…

#include <vector>

std::vector<int> test;

Turns out we can’t use C++ standard library in C++ with unreal. I’m writing a wrapper class to convert from std to Unreal specific types.
Though I still have to include the precompiled project header. This slowed my program performance a lot which I’m not happy about it.
Thanks for the replies by the way.

I haven’t had any problems using the std lib personally. Could the problem be stemming from the platforms you are trying to target? For example: Android has limited support for the std lib (if I remember correct, it was the std FFT that had me beating my head against the wall for a bit until I looked into what parts of the std lib were actually supported on Android lol).

I also cant compile any std library. for me it throws the error.

error LNK2019: unresolved external symbol “void __cdecl std::_Xlength_error(char const *)” (?_Xlength_error@std@@YAXPEBD@Z) referenced in function

I have no idea how to resolve it.

You need to rewrite it to Unreal’s datatypes. You can’t use both and only Unreal’s is supported in systems such as Blueprints.

1 Like

thank you :slight_smile: Took a while for me to figure out what that error actually meant.

I actually keep getting problems with this error because it somehow finds a none exesiting function somewhere while building which still uses int instead of int32 and i cant understand why it finds this as no cpp file like that exists. I tried cleaning up the whole thing but that doesnt seem to work sadly.

Maybe i am doing something fundementaly wrong that i dont understand. Is there by any change some reference page with basic examples of defining functions for the UE5 standard ?

using namespace std;

#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "stdlib.h"
#include "queue"
#include "BP_Queue.generated.h"

using namespace std;

class SIMULATIONTEST_API UBP_Queue : public UObject


	UFUNCTION(Category = Utility, BlueprintCallable)
	void push(const int32 x,const int32 y);

	UFUNCTION(Category = Utility, BlueprintCallable)
	void front(int32 x, int32 y);

even without using much else it still generates the same problem saying the function push has unresolved references. This is so frustrating.

Error: 1>BP_Queue.gen.cpp.obj : error LNK2019: unresolved external symbol “public: void __cdecl UBP_Queue::push(int,int)” (?push@UBP_Queue@@QEAAXHH@Z) referenced in function “public: static void __cdecl UBP_Queue::execpush(class UObject *,struct FFrame &,void * const)”

Nvm. Looks like i am an idiot and forgot to add the UBP_Queue:: in front of the functions in the cpp file.

1 Like

Also, about that header and your question earlier:

Include What You Use (IWYU) for Unreal Engine Programming | Unreal Engine 5.2 Documentation

UFunctions | Unreal Engine Documentation

Gameplay Classes | Unreal Engine Documentation

You need to follow a few tutorials on youtube on the basics