# Can't compile C++ script

**URL:** <https://forums.unrealengine.com/t/cant-compile-c-script/362783>\
**Category:** Pipeline & Plugins\
**Tags:** unreal-engine, editor, Visual-Studio, UE4, CPP, question\
**Created:** [July 3, 2016, 4:17am UTC](https://forums.unrealengine.com/t/cant-compile-c-script/362783 "2016-07-03T04:17:04Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![patrakus](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@patrakus](https://forums.unrealengine.com/u/patrakus)\
**Post date:** [July 3, 2016, 4:17am UTC](https://forums.unrealengine.com/t/cant-compile-c-script/362783/1 "2016-07-03T04:17:04Z")

</div>

I can’t compile C++ scipts and additionally my project can’t be opened after create scipt. I get this message when I create new C++ file

![96965-1.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/7/0/b709169a71e4f638bd88268501ff18ddf6f9b8e6.png)

and when I want open once again my project I get this message

![96964-2.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/6/a/e6a3e714e34843e9712a8d023ac44d39ba4c68e6.png)

When I confirm this I wait few secunds and rebuild failed.

Here are logs from editor when I create new C++ file:

```
Running C:/Program Files (x86)/Epic Games/4.12/Engine/Binaries/DotNET/UnrealBuildTool.exe -projectfiles -project="C:/Users/patryk/Documents/Unreal Projects/MyProject5/MyProject5.uproject" -game -rocket -progress
Discovering modules, targets and source code for project...
LogHotReload: Recompiling module MyProject5...
LogVSAccessor:Warning: Couldn't access Visual Studio
Recompiling MyProject5...
Launching UnrealBuildTool... [C:/Program Files (x86)/Epic Games/4.12/Engine/Binaries/DotNET/UnrealBuildTool.exe MyProject5 -Module MyProject5 Win64 Development -editorrecompile -canskiplink "C:/Users/patryk/Documents/Unreal Projects/MyProject5/MyProject5.uproject" -2015]
Performing full C++ include scan (hot reloading a new target)
Creating makefile for hot reloading MyProject5 (no existing makefile)
Compiling game modules for hot reload
Performing 6 actions (4 in parallel)
[3/6] Resource ModuleVersionResource.rc.inl
[2/6] Resource PCLaunch.rc
PCH.MyProject5.h.cpp
MyClass.cpp
MyProject5.cpp
C:\Users\patryk\Documents\Unreal Projects\MyProject5\Source\MyProject5\MyProject5.cpp: error C4599: '/IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE': command line argument number 260 does not match precompiled header
C:\Users\patryk\Documents\Unreal Projects\MyProject5\Source\MyProject5\MyClass.cpp: error C4599: '/IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE': command line argument number 260 does not match precompiled header
ERROR: UBT ERROR: Failed to produce item: C:\Users\patryk\Documents\Unreal Projects\MyProject5\Binaries\Win64\UE4Editor-MyProject5.dll
Total build time: 62,73 seconds
CompilerResultsLog: New page: Compilation - Jul 3, 2016, 7:14:37 AM
CompilerResultsLog: Info Performing full C++ include scan (hot reloading a new target)
CompilerResultsLog: Info Creating makefile for hot reloading MyProject5 (no existing makefile)
CompilerResultsLog: Info Compiling game modules for hot reload
CompilerResultsLog: Info Performing 6 actions (4 in parallel)
CompilerResultsLog: Info [3/6] Resource ModuleVersionResource.rc.inl
CompilerResultsLog: Info [2/6] Resource PCLaunch.rc
CompilerResultsLog: Info PCH.MyProject5.h.cpp
CompilerResultsLog: Info MyClass.cpp
CompilerResultsLog: Info MyProject5.cpp
CompilerResultsLog: Info C:\Users\patryk\Documents\Unreal Projects\MyProject5\Source\MyProject5\MyProject5.cpp: error C4599: '/IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE': command line argument number 260 does not match precompiled header
CompilerResultsLog: Info C:\Users\patryk\Documents\Unreal Projects\MyProject5\Source\MyProject5\MyClass.cpp: error C4599: '/IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE': command line argument number 260 does not match precompiled header
CompilerResultsLog: Info ERROR: UBT ERROR: Failed to produce item: C:\Users\patryk\Documents\Unreal Projects\MyProject5\Binaries\Win64\UE4Editor-MyProject5.dll
CompilerResultsLog: Info Total build time: 62,73 seconds
LogMainFrame: MainFrame: Module compiling took 62.963 seconds
```

---

<div class="post-metadata">

**Author:** ![Jamie\_Dale](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jamie_dale/32/1165413_2.png) [@Jamie\_Dale](https://forums.unrealengine.com/u/Jamie_Dale)\
**Post date:** [July 3, 2016, 5:31pm UTC](https://forums.unrealengine.com/t/cant-compile-c-script/362783/2 "2016-07-03T17:31:43Z")

</div>

> **[Compile Failed when creating Cpp project](https://forums.unrealengine.com/questions/445126/compile-failed-when-creating-cpp-project.html)**
>
> I recently updated Visual Studio to include all the Android SDK’s as I was having problems getting a VR project to work on my Nexus 6. This solved that particular problem in a blueprints project, but when creating a Cpp project I get an error and...

---

<div class="post-metadata">

**Author:** ![youthnick](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@youthnick](https://forums.unrealengine.com/u/youthnick)\
**Post date:** [July 19, 2016, 9:10am UTC](https://forums.unrealengine.com/t/cant-compile-c-script/362783/3 "2016-07-19T09:10:31Z")

</div>

I finally solved this problem , i added new C++ class(eg:slate widget) instead of empty c++ class.

Officially tutorial told me that i should create empty c++ class. But this doesn’t works for me.

Hope this help for you .And tell me if this works.

---

<div class="post-metadata">

**Author:** ![youthnick](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@youthnick](https://forums.unrealengine.com/u/youthnick)\
**Post date:** [July 20, 2016, 7:32am UTC](https://forums.unrealengine.com/t/cant-compile-c-script/362783/4 "2016-07-20T07:32:18Z")

</div>

Sorry for my careless , The correct way is delete “Saved ， Intermediate" folder in you folder .Then add c++ class in your project.
