# Why can't I open include files?

**URL:** <https://forums.unrealengine.com/t/why-cant-i-open-include-files/282421>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine\
**Created:** [May 3, 2014, 7:47pm UTC](https://forums.unrealengine.com/t/why-cant-i-open-include-files/282421 "2014-05-03T19:47:32Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chrys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chrys](https://forums.unrealengine.com/u/Chrys)\
**Post date:** [May 3, 2014, 7:47pm UTC](https://forums.unrealengine.com/t/why-cant-i-open-include-files/282421/1 "2014-05-03T19:47:32Z")

</div>

Hello,

I have written a library that I want to use in my new UE4 project.

So I have added a include and lib folder to the /Engine/Source/ThirdParty/ folder (as described in this forum post [UE4 AnswerHub](https://answers.unrealengine.com/questions/3083/c-adding-include-directories.html)

It all works fine when I generate the solution files there is effectively now a folder called “AWFramework” and it contains the cs build file.

Unfortunately when I try and include any header from my library then I get a compiler error saying that the header cannot be opened.

Now I am usually quite familiar with as to why the header cannot be found but with this unreal build system I am a bit confused.

here my CS build file

```
// Copyright 1998-2014 Epic Games, Inc. All Rights Reserved.
using UnrealBuildTool;

public class AWFramework : ModuleRules
{
    public AWFramework(TargetInfo Target)
	{
		Type = ModuleType.External;

		if ((Target.Platform == UnrealTargetPlatform.Win64) ||
			(Target.Platform == UnrealTargetPlatform.Win32))
		{
            PublicIncludePaths.Add(UEBuildConfiguration.UEThirdPartyDirectory + "AWThirdParty/AWFramework/libAWFramework/Include");

            string LibraryPath = UEBuildConfiguration.UEThirdPartyDirectory + "AWThirdParty/AWFramework/libAWFramework/Lib/";
			string LibraryName = "libAWFramework";
			if (Target.Platform == UnrealTargetPlatform.Win64)
			{
				LibraryPath += "x64/";
			}
            else if (Target.Platform == UnrealTargetPlatform.Win32)
            {
                LibraryPath += "Win32/";
            }
			PublicLibraryPaths.Add(LibraryPath);
			PublicAdditionalLibraries.Add(LibraryName + ".lib");
		}
	}
}

```

I have triple checked that the header files are effectively at the right location and that my paths are correct, but the problem seems to be that if I reference my library header from within my game code, I need to specify something like this

```
#include "ThirdParty/AWThirdParty/AWFramework/libAWFramework/Include/AWFrameworkAll.h"

```

but the inside the library code itself it complains that it can’t find the header i.e.

```
#include "Networking/Sockets/ZMQ/AWZMQSocketBase.h"

```

but I can guarantee that as specified in the cs build file public path that I added , the file should be there

i.e.

UEBuildConfiguration.UEThirdPartyDirectory + “AWThirdParty/AWFramework/libAWFramework/Include” +  
“Networking/Sockets/ZMQ/AWZMQSocketBase.h”

should exists.

so how do I make sure that the paths for files referenced from my unreal game are compatible with paths referenced by my library. As far as I know usually the paths are looked up depending on what additional path directories are being added to a project but I can’t seem to find any such thing in the UE4 project(in fact I believe that is what

```
PublicIncludePaths.Add

```

is supposed to do.

Any idea ?

---

<div class="post-metadata">

**Author:** ![Chrys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chrys](https://forums.unrealengine.com/u/Chrys)\
**Post date:** [May 3, 2014, 7:52pm UTC](https://forums.unrealengine.com/t/why-cant-i-open-include-files/282421/2 "2014-05-03T19:52:41Z")

</div>

In fact if I add

```
#include "ThirdParty/AWThirdParty/AWFramework/libAWFramework/Include/Networking/Sockets/ZMQ/AWZMQSocketBase.h"

```

instead of just

```
#include "Networking/Sockets/ZMQ/AWZMQSocketBase.h"

```

then it compiles but that is obviously wrong, the library needs to be agnostic of where it is being used.

any suggestion would be appreciated 🙂

---

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [May 3, 2014, 10:12pm UTC](https://forums.unrealengine.com/t/why-cant-i-open-include-files/282421/3 "2014-05-03T22:12:54Z")

</div>

#Wiki Tutorial

Have you read this tutorial?

> **[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...

Is this what you need?

#Build.cs

```
public class UE4Magic : ModuleRules
{
    [Convenience Properties]
 
    [Constructor]
 
    public bool LoadBobsMagic(TargetInfo Target)
    {
        bool isLibrarySupported = false;
 
        if ((Target.Platform == UnrealTargetPlatform.Win64) || (Target.Platform == UnrealTargetPlatform.Win32))
        {
            isLibrarySupported = true;
 
            string PlatformString = (Target.Platform == UnrealTargetPlatform.Win64) ? "x64" : "x86";
            string LibrariesPath = Path.Combine(ThirdPartyPath, "BobsMagic", "Libraries");
 
            PublicAdditionalLibraries.Add(Path.Combine(LibrariesPath, "BobsMagic." + PlatformString + ".lib")); 
        }
 
        if (isLibrarySupported)
        {
            // Include path
            PublicIncludePaths.Add( Path.Combine( ThirdPartyPath, "BobsMagic", "Includes" ) );
        }
 
        Definitions.Add(string.Format( "WITH_BOBS_MAGIC_BINDING={0}", isLibrarySupported ? 1 : 0 ) );
 
        return isLibrarySupported;
    }
```

---

<div class="post-metadata">

**Author:** ![Chrys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chrys](https://forums.unrealengine.com/u/Chrys)\
**Post date:** [May 3, 2014, 10:22pm UTC](https://forums.unrealengine.com/t/why-cant-i-open-include-files/282421/4 "2014-05-03T22:22:32Z")

</div>

I think if I compare the code you wrote with the cs file I posted above there isn’t much difference. Or can you see something missing ?

---

<div class="post-metadata">

**Author:** ![Rama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/rama/32/882413_2.png) [@Rama](https://forums.unrealengine.com/u/Rama)\
**Post date:** [May 3, 2014, 10:45pm UTC](https://forums.unrealengine.com/t/why-cant-i-open-include-files/282421/5 "2014-05-03T22:45:27Z")

</div>

well I didnt write the code, but if you and Bob Gneu matched up that well, the rest of his tutorial should be helpful!

> **[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:** ![Chrys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chrys](https://forums.unrealengine.com/u/Chrys)\
**Post date:** [May 4, 2014, 11:05pm UTC](https://forums.unrealengine.com/t/why-cant-i-open-include-files/282421/6 "2014-05-04T23:05:59Z")

</div>

okay so I got finally my includes working. I had some issues with where I placed my third party code, I moved it and now at least it seems to get one step further.

I receive now a ton of errors where Unreal seems to dislike some data types that the library uses. I know the wiki page mentions that but it doesn’t mention how to fix it so here is the problem

```
    19>C:\Program Files (x86)\Windows Kits\8.1\include\shared\ws2def.h(245): error C2872: 'INT' : ambiguous symbolC:\Program Files (x86)\Windows Kits\8.1\include\shared\ws2def.h(245) : error C2872: 'INT' : ambiguous symbol
    19>  
    19> could be 'C:\Program Files (x86)\Windows Kits\8.1\include\shared\minwindef.h(176) : int INT'
    19> or 'I:\Projects\AWOnline\UnrealEngine\Engine\Source\Runtime\Core\Public\Core.h(509) : DoNotUseOldUE4Type::INT'

```

There is a very similar error about DWORD which unreal also doesn’t seem to like.

---

<div class="post-metadata">

**Author:** ![Chrys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chrys](https://forums.unrealengine.com/u/Chrys)\
**Post date:** [May 4, 2014, 11:42pm UTC](https://forums.unrealengine.com/t/why-cant-i-open-include-files/282421/7 "2014-05-04T23:42:08Z")

</div>

from the Core.h in unreal

```
/// Trick to prevent people from using old UE4 types (which are still defined in Windef.h on PC).
namespace DoNotUseOldUE4Type
{
	/// Used to cause compile errors through typedefs of unportable types. If unportable types 
	/// are really necessary please use the global scope operator to access it (i.e. :: INT). 
	/// Windows header file includes can be wrapped in #include "AllowWindowsPlatformTypes.h" 
	/// and #include "HideWindowsPlatformTypes.h"

```

looks like Epic indeed does some trickery here.

---

<div class="post-metadata">

**Author:** ![Chrys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chrys](https://forums.unrealengine.com/u/Chrys)\
**Post date:** [May 5, 2014, 12:09am UTC](https://forums.unrealengine.com/t/why-cant-i-open-include-files/282421/8 "2014-05-05T00:09:33Z")

</div>

okay so here is the solution, anywhere you include a library header you can simply put the above mentioned wrappers around … i.e.

```
#include "AllowWindowsPlatformTypes.h"
#include "MyLibraryHeader.h" 
#include "HideWindowsPlatformTypes.h"

```

I would strongly suggest to create a header file that includes all relevant header files from any external library and just wrap the entire block and then just include that header file where you need have access to your library.

---

<div class="post-metadata">

**Author:** ![LennardF1989](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/lennardf1989/32/555632_2.png) [@LennardF1989](https://forums.unrealengine.com/u/LennardF1989)\
**Post date:** [May 18, 2014, 12:05am UTC](https://forums.unrealengine.com/t/why-cant-i-open-include-files/282421/9 "2014-05-18T00:05:48Z")

</div>

Where did you move it too to get this far? I have the same problem.

---

<div class="post-metadata">

**Author:** ![Chrys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chrys](https://forums.unrealengine.com/u/Chrys)\
**Post date:** [May 18, 2014, 12:35am UTC](https://forums.unrealengine.com/t/why-cant-i-open-include-files/282421/10 "2014-05-18T00:35:07Z")

</div>

my project folders look like this  
MyGame  
- Binaries  
- Build  
- Config  
- Content  
- DerivedDataCache  
- Intermediate  
- Plugins  
- Saved  
- Source  
- ThirdParty

hope that helps

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8fe13cbf1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8fe13cbf1](https://forums.unrealengine.com/u/anonymous_user_8fe13cbf1)\
**Post date:** [June 3, 2014, 8:39pm UTC](https://forums.unrealengine.com/t/why-cant-i-open-include-files/282421/11 "2014-06-03T20:39:24Z")

</div>

Hey man, thx for all the help so far! I managed to get rid of the errors you mentioned here, but now i have problems using functions from the library. For example i have function that returns a string but i get link errors like this one:

error LNK2019: unresolved external symbol “public: static class std::basic\_string,class std::allocator \> \_\_cdecl myTester::islibAlive(void)” (?islibAlive@myTester@@SA?AV?$basic\_string@DU?$char\_traits@D@std@@anonymous_user_e71e0d8a?$allocator@D@2@@std@@XZ) referenced in function “public: \_\_cdecl AUtester::AUtester(class FPostConstructInitializeProperties const &)” (??0AUtester@@QEAA@AEBVFPostConstructInitializeProperties@@@Z)

Same thing with a function that returns a float value. If you could help in any way i would greatly appreciate it!

---

<div class="post-metadata">

**Author:** ![Chrys](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chrys](https://forums.unrealengine.com/u/Chrys)\
**Post date:** [June 3, 2014, 10:36pm UTC](https://forums.unrealengine.com/t/why-cant-i-open-include-files/282421/12 "2014-06-03T22:36:23Z")

</div>

this usually means the library isn’t correctly references In the project or the library isn’t exporting the function (in case its a dll). Its not an unreal specific error.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_8fe13cbf1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_8fe13cbf1](https://forums.unrealengine.com/u/anonymous_user_8fe13cbf1)\
**Post date:** [June 4, 2014, 10:13am UTC](https://forums.unrealengine.com/t/why-cant-i-open-include-files/282421/13 "2014-06-04T10:13:50Z")

</div>

I really don’t get what the problem is, if i change for example the path to the lib in the build file it gives me errors, even when i use the a function from the lib in code it gives me no intellisense errors, the only error that it does give is the one i gave above. I really don’t get what am i doing wrong…

---

<div class="post-metadata">

**Author:** ![Institut\_Image\_1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Institut\_Image\_1](https://forums.unrealengine.com/u/Institut_Image_1)\
**Post date:** [March 13, 2015, 9:30am UTC](https://forums.unrealengine.com/t/why-cant-i-open-include-files/282421/14 "2015-03-13T09:30:17Z")

</div>

Hi  
This topic is a bit old but I had the unresolved link problem and I solve it by compiling the dependancies in 64bits. Maybe your dependancies are 32bitss ??  
btw, I am now trying to run my UE4 VC2013 project with a win32 settings (all my dependancies are not 64bits) but I have got a “fatal error C1083: Cannot open include file: ‘MyProject21.h’: No such file or directory”  
Does anyone has any new thoughts about that ?
