How to #include vector <>? or other members of the standard library?

Hi, yes thats the nature, and its is easy, to integrate a .lib in windows for example or another library for another platform, you have to use the Unreal build system, basically you can define your compiles rules, for instance you can use this inside your Build.cs file:


I would like recommend you this wiki: A new, community-hosted Unreal Engine Wiki - Announcements - Unreal Engine Forums

Also if you began with ue, take a look to every wiki in the page.

Is it possible to #include within the UE4? I know that UE4 have built there own container types for cross platform compatibility but in my scenario my “game” will always be run on windows (and possibly only on one computer).

Ideally I would like to be able to somehow link to the standard library. Is this possible? For example, somehow link to a .lib containing the standard library? Is this even possible? I am fairly new to c++ so forgive me if it sounds like a silly question!


I’ve actually had a look at that tutorial and managed to link a static library of my own. However I keep getting errors when I try to use functions which involve vector. I was hoping to find a way of just using the standard library within UE4. That is have parts of my code which entirely use the standard library.

If I wanted to use the standard library do I need to somehow download the standard library in .lib format and then use the mentioned tutorial to link it to my project?

no, that is not about use libraries, by default unreal hates c++ stl really hard , I afraid you will not able to use vector<> inside UE, port everything to TArray or you can port everything inside a dll, and then call it from UE, without let unreal touch those vectors, otherwise you will be in big trouble

Hey, thanks for the response. By port everything inside a dll do you mean turn my exisiting c++ code (which uses STL) into a dynamic library and call that from UE?

For example lets say I build a library which has simple and useless function which takes in three doubles, turns them into a vector and then sums the vector:

	double MyMathFuncs::vectorsum(double a, double b, double c)
		std::vector<double> myVec;
		double sum = 0.0;
		for (unsigned i = 0; i < myVec.size(); i++) {
			sum += myVec[i];

		return sum;

Can I call this function from within UE by turning the above into a library and linking the library?

I was able to resolve my problem by creating a static library that uses the standard library. You must ensure that you are using Visual Studio 2015 update 3 and the static library is built using release 64x. From there you can follow the Unreal tutorial of linking static libraries to UE4 and it should work fine. Although, it does increase build times considerably.