# adding vanilla c++ to a UE4 project

**URL:** <https://forums.unrealengine.com/t/adding-vanilla-c-to-a-ue4-project/9829>\
**Category:** C++\
**Tags:** unreal-engine\
**Created:** [August 21, 2014, 1:50am UTC](https://forums.unrealengine.com/t/adding-vanilla-c-to-a-ue4-project/9829 "2014-08-21T01:50:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_086249b7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_086249b7](https://forums.unrealengine.com/u/anonymous_user_086249b7)\
**Post date:** [August 21, 2014, 1:50am UTC](https://forums.unrealengine.com/t/adding-vanilla-c-to-a-ue4-project/9829/1 "2014-08-21T01:50:48Z")

</div>

I tried to get the logitech sdk running in my ue4 project. I plan to use it to interface with my g27 steering wheel and a project based off of the vehicle template (c++ version). The sdk itself is just a bunch of cpp and .h files, no .lib files or dlls to include.

So, I tried to just add the code to my project like i would normally do in visual studio…copy the sdk source folder to the project, in vis studio, add existing, select the source code etc. I also notice that i can just drop in the code to the project, and it would still be “included” but I’m sure thats more of the ue4 build stuff, not nesc visual studio integrating it to the project. Anyway, once the sdk was in place, the code wouldn’t compile because of the conflicts with “INT” “DWORD” and other windows typedefs. I tried to follow the advice of this ue4 answer:

> **[Trouble using windows includes with DWORD, INT](https://forums.unrealengine.com/questions/27560/trouble-using-windows-includes-with-dword-int.html)**
>
> Hello, I’m trying to use a static library that use some includes files of windows sdk (winsock2.h) but I get compilation errors about ambiguous symbols: DWORD and INT. I searched in the documentation and those symbols appears to be, in unreal,...

and this forum post:

> **[Taking a plain C++ Program into Unreal](https://forums.unrealengine.com/showthread.php?10547-Taking-a-plain-C-Program-into-Unreal)**
>
> Alright its about time to get started! In any case, I’ve got a fun little program capable of generating a tiled cave system. You feed it a width and a height(current maxes at 100), then you can feed it the max room size(3 is the min, 9 works great),...

but, no dice. No matter how I ordered the includes, it would not compile. I would either get the “no nested includes allowed” error, or the error that states “the premade header for this project must be first.”

since there are a lot of files in the logitech sdk, I decided to remove that code (once i did, it would build no problem) add my own vanilla c++ code instead, hoping that I can figure it all out with simple code.

So i made a header file:

```auto

#ifndef MY_TEST_H_INCLUDED_
#define MY_TEST_H_INCLUDED_

#include "carTest.h" //the name of the project. i also tried having this under the AllowWindowsPlatformTypes...no luck
#include "AllowWindowsPlatformTypes.h"

class testClass
{
	public:
	int x,y;
	int someMethod();
};

 #endif //MY_MAIN_H_INCLUDED_ 
#include "HideWindowsPlatformTypes.h" //i had this up above as the last include as well, no luck

```

and this class implementation

```auto

#include "carTest.h"
#include "AllowWindowsPlatformTypes.h"
#include "testClass.h"

int testClass::someMethod()
{
	return x + y;
}
#include "HideWindowsPlatformTypes.h"

```

but, I’m still getting the same issues, and my google-fu is failing me. I’m not sure how to fix this, so any help is appreciated.

Thanks

---

<div class="post-metadata">

**Author:** ![jCoder](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jCoder](https://forums.unrealengine.com/u/jCoder)\
**Post date:** [August 21, 2014, 3:08am UTC](https://forums.unrealengine.com/t/adding-vanilla-c-to-a-ue4-project/9829/2 "2014-08-21T03:08:47Z")

</div>

Precompiled headers are used in UE4. So you need to put cartest.h first in the cpp file, but not at all in the .h file. Also move the AllowWindowsPlatformTypes.h after the #include “testClass.h” in the .cpp file.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_086249b7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_086249b7](https://forums.unrealengine.com/u/anonymous_user_086249b7)\
**Post date:** [August 21, 2014, 4:54am UTC](https://forums.unrealengine.com/t/adding-vanilla-c-to-a-ue4-project/9829/3 "2014-08-21T04:54:38Z")

</div>

> [@jCoder;122493](#):
>
> Precompiled headers are used in UE4. So you need to put cartest.h first in the cpp file, but not at all in the .h file. Also move the AllowWindowsPlatformTypes.h after the #include “testClass.h” in the .cpp file.

Thanks for the reply, I followed your advice, and I was able to build the code! 🆒

I then added INT z; to the class definition, so i can try to figure out how to build the logitech code like so:

```auto

#ifndef MY_TEST_H_INCLUDED_
#define MY_TEST_H_INCLUDED_

#include "AllowWindowsPlatformTypes.h"
class testClass
{
	public:
	int x,y;
	int someMethod();
	INT z; //NEW!
};
#include "HideWindowsPlatformTypes.h"
 #endif //MY_TEST_H_INCLUDED_ 

```

then changed someMethod() to look like:

```auto

#include "carTest.h"
#include "testClass.h"

int testClass::someMethod()
{
	return x + y + z;
}

```

and that works! So, hopefully I can use this info to get the logitech code to build. I’ll update this post once i figure it all out.

Thanks again for the help.

[edit]

at first glance, adding the logitech stuff wont be as easy as my test example because some header files include other header files, this creates the “Nesting AllowWindowsPLatformTypes.h is not allowed!” error.  
I’ll have to see what i can do. Maybe change the types to normal types, or see if all header files need AllowWindowsPLatformTypes.h to be included.

---

<div class="post-metadata">

**Author:** ![jCoder](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jCoder](https://forums.unrealengine.com/u/jCoder)\
**Post date:** [August 21, 2014, 1:08pm UTC](https://forums.unrealengine.com/t/adding-vanilla-c-to-a-ue4-project/9829/4 "2014-08-21T13:08:18Z")

</div>

kablammyman, please keep me informed. I’ve talked to a number of people who were interested in a F27 support. I don’t have one so I haven’t spent any time on it, but when you get it working there are people out there who want it.

One thought. Consider compiling the Logitech code into a library and linking in the library. I found this easier then tryingto get third party code to compile into the engine.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_086249b7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_086249b7](https://forums.unrealengine.com/u/anonymous_user_086249b7)\
**Post date:** [August 21, 2014, 4:09pm UTC](https://forums.unrealengine.com/t/adding-vanilla-c-to-a-ue4-project/9829/5 "2014-08-21T16:09:04Z")

</div>

okay, I’ll keep you updated. Also, thanks for the tip. Playing around with the include order hasn’t been helping so far, so I may just try the lib approach.

---

<div class="post-metadata">

**Author:** ![jCoder](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@jCoder](https://forums.unrealengine.com/u/jCoder)\
**Post date:** [August 21, 2014, 4:17pm UTC](https://forums.unrealengine.com/t/adding-vanilla-c-to-a-ue4-project/9829/6 "2014-08-21T16:17:22Z")

</div>

You’ll find these two articles helpful. I know I did.

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_086249b7](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_086249b7](https://forums.unrealengine.com/u/anonymous_user_086249b7)\
**Post date:** [August 22, 2014, 8:00pm UTC](https://forums.unrealengine.com/t/adding-vanilla-c-to-a-ue4-project/9829/7 "2014-08-22T20:00:17Z")

</div>

since the original question has been answered, I started a new thread for the g27 progress here:

> **[My adventure with the logitech sdk and ue4](https://forums.unrealengine.com/showthread.php?31112-My-adventure-with-the-logitech-sdk-and-ue4&p=123616#post123616)**
>
> ahem to recap: I want to use the g27 features in ue4. I tried to build the code, but i had issues. heres a thread about that: Anyway, after trying to wrestle with the logitech code, I got frustrated and realized how stupid this approach is. I...
