Bug: 'C++ Compile Failed'. I Cannot create a C++ project

I would also like to add that I just ran a Malware scanner on my computer that detected a very nasty .ms trojan something or other that hides in the background breaking stuff, a level 4 out of 5 on the threat scale. I am obviously wondering if that could be a reason its not working.

I know other people have reported this problem, but I have not heard any body offer a solution or admit that it is a bug they need to fix.

Yeah this bug is ridiculous. I reinstalled UE4 4.16 and got the same cannot compile error. But went into VS2017 and built the solution successfully using their ‘Build’ tool and attempted to start the program with the ‘start without debugging’ tool. At this point I get a message that says,

'the following modules are missing
or built with a different engine
version:
UE4Editor-MyProjectCPPtest.dll would
you like to rebuild them now?

If I hit yes, it says, ‘cannot compile’, if I hit No it does nothing.

I think I have to go into the .uproject files or something and disable some modules that were not installed properly in this version or something or other. Can someone help me with that?

Bump. I am pretty confident the problem is that some modules need to be disabled somewhere or other. Can someone help me out with this?

can't create and compile new C++ project - C++ - Epic Developer Community Forums

Quote Originally Posted by Zeblote
View Post

You’re probably missing some

VS components. Open the installer
again and make sure these are enabled:

  • Desktop development with .NET
  • Desktop development with C++
  • Game development with C++

The windows 8.1 sdk also needs to be
enabled under individual components.


This is the correct answer. After following your instruction C++ projects for UE4 4.16 loaded up perfectly and double clicking C++ classes in UE4 caused VS2017 to load the code just as it should.

However oddly enough I had previously had literally everything VS had to offer installed, for no good reasons, and did not work. I Uninstalled all that unnecessary stuff and reinstalled with only the needed stuff, and it worked.

It says it cant open ws2_32.lib thats the Windows Socket Library. So either something blocks the Access (Sockets are something Anti Virus/Malware definitly looks out for)

Or something is missing on your System. Win 8.1 SDK, CPP Runtime, .NET stuff etc you got to double check that and if in doubt reinstall. Especially Win 8.1 SDK!

This guide might help you also but thats no gurantee that everything got installed correctly!

Haha exactly my last comment 4 minutes before you posted the Answer :stuck_out_tongue_winking_eye:

Ok, it came back… This time it says license is invalid. What do you thing that means? below is not the full error message.


The project could not be compiled. Would you like to open it in Visual Studio?

Distributing 8 actions to XGE
--------------------Build System Warning---------------------------------------
License is invalid:
License information is invalid. Please try reloading your license file using the Coordinator Monitor application on the Coordinator machine, or reinstall IncrediBuild.
This build will run in standalone mode.


--------------------Project: Default-------------------------------------------
(0:20.51 at +0:00)
SharedPCH.Engine.cpp
(0:00.23 at +0:20)
UDemy_BuildingEscape.cpp
(0:00.26 at +0:20)
UDemy_BuildingEscapeGameModeBase.cpp
(0:00.34 at +0:21)
UDemy_BuildingEscape.generated.cpp
ModuleVersionResource.rc.inl (0:00.56 at +0:21)
PCLaunch.rc (0:00.09 at +0:21)
UE4Editor-UDemy_BuildingEscape.dll (0:00.14 at +0:22)
LINK : fatal error LNK1181: cannot open input file ‘ws2_32.lib’

Error executing C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\link.exe (tool returned code: 1181)
---------------------- Done ----------------------

Rebuild All: 0 succeeded, 1 failed, 0 skipped

**1 build system warning(s):

  • License is invalid**

ERROR: UBT ERROR: Failed to produce item: C:\Unreal Projects\UDemy_BuildingEscape\Binaries\Win64\UE4Editor-UDemy_BuildingEscape.dll
Total build time: 51.51 seconds (XGE executor: 0.00 seconds)


Thats because Incredibuild is Paid software deinstall the extension :stuck_out_tongue_winking_eye: or disable it somehow inside VS. I don´t use Incredi Build so can´t help you there.

Ok, the Incredibuild stuff is gone now, but now it says it ‘Failed to produce item’ . It worked one time after following aforesaid instruction, then this again :frowning:

The project could not be compiled. Would you like to open it in Visual Studio?

Running C:/Program Files/Epic Games/UE_4.16/Engine/Binaries/DotNET/UnrealBuildTool.exe Udemy_EscapeBuilding Development Win64 -project=“C:/Unreal Projects/Udemy_EscapeBuilding/Udemy_EscapeBuilding.uproject” -editorrecompile -progress -NoHotReloadFromIDE
Performing full C++ include scan (building a new target)
Creating makefile for Udemy_EscapeBuilding (no existing makefile)
@progress push 5%
Parsing headers for Udemy_EscapeBuildingEditor
Running UnrealHeaderTool “C:\Unreal Projects\Udemy_EscapeBuilding\Udemy_EscapeBuilding.uproject” "C:\Unreal Projects\Udemy_EscapeBuilding\Intermediate\Build\Win64\Udemy_EscapeBuildingEditor\Development

\Udemy_EscapeBuildingEditor.uhtmanifest" -LogCmds=“loginit warning, logexit warning, logdatabase error” -Unattended -WarningsAsErrors -installed
Reflection code generated for Udemy_EscapeBuildingEditor in 5.6123431 seconds

@progress pop
Performing 8 actions (4 in parallel)
[2/8] Resource ModuleVersionResource.rc.inl
[3/8] Resource PCLaunch.rc
SharedPCH.Engine.cpp
Udemy_EscapeBuilding.cpp
Udemy_EscapeBuilding.generated.cpp
Udemy_EscapeBuildingGameModeBase.cpp
[7/8] Link UE4Editor-Udemy_EscapeBuilding.dll
[8/8] Link UE4Editor-Udemy_EscapeBuilding.lib
LINK : fatal error LNK1181: cannot open input file 'ws2_32.lib’
Creating library C:\Unreal Projects\Udemy_EscapeBuilding\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-Udemy_EscapeBuilding.lib and object C:\Unreal Projects\Udemy_EscapeBuilding\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-Udemy_EscapeBuilding.exp
ERROR: UBT ERROR: Failed to produce item: C:\Unreal Projects\Udemy_EscapeBuilding\Binaries\Win64\UE4Editor-Udemy_EscapeBuilding.dll
Total build time: 12.67 seconds (Local executor: 0.00 seconds)

Can you build from VS and upload the whole Outputlog as .txt or upload on www.pastebin.com please?

Also please reinstall by Hand:

yeah, will do

Ok, I reinstalled VS2017 with all the required components, including a fresh ‘windows-8-1-sdk’ component. It was about a 6.5 GB install for me. and yes I did install the ‘Unreal Engine Installer’ component.

Got the Compile error message again, though it was smaller this time, same, LINK : fatal error LNK1181: cannot open input file ‘ws2_32.lib’ thingy.

here is the whole output log from VS after building the project:

***1>------ Build started: Project: UE4, Configuration: BuiltWithUnrealBuildTool Win32 ------

2>------ Build started: Project: Udemy_BuildingEscape, Configuration: Development_Editor x64 ------

2>Performing full C++ include scan (hot reloading a new target)

2>Creating makefile for hot reloading Udemy_BuildingEscapeEditor (no existing makefile)

2>Compiling game modules for hot reload

2>Target is up to date

2>Deploying Udemy_BuildingEscapeEditor Win64 Development…

2>Total build time: 1.77 seconds (NoActionsToExecute executor: 0.00 seconds)

========== Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========***

The unreal editor does not load up the way it should.
Also I turned off my AntiVirus/Firewall and AntiMalware to see if that was blocking. It was NOT, so the bug is not caused by my security software. I get the same compile error regardless.

Build: 2 succeeded, 0 failed, 0 up-to-date, 0 skipped

According to your Output everything compiled fine. No Errors no failures. You should be able to open your Project now.

Can I ask you what you mean by the Editor does not load up the way it should? And where do you see the Error message again?

yeah its simple.

I click on UE4 4.16.1 > Browser opens up > I go to New Project > I go to C++ tab > I select Basic Code (my location is just C:\Unreal Projects) > I enter a name for the project > I punch the button Create Project > HERE THE ERROR HAPPENS, Project fails to compile and the UE4 editor will not open. I get and error message that says, ‘Compile Failed’ and it asks me if I want open the project with Visual Studio 2017. If I do this it tells me I can upgrade my toolset if I want to.

So that is the bug. No Unreal Editor, and a compile failure.

The project should Compile and the Unreal editor should open and I should be able to easily access any C++ classes by double clicking (that will cause VS2017 to load up with the code).

Here is list of VS2017 components installed:

.NET Framework 4 targeting pack

.NET Framework 4.5 targeting pack

.NET Framework 4.5.1 targeting pack

.NET Framework 4.5.2 targeting pack

.NET Framework 4.6 targeting pack

.NET Framework 4.6.1 SDK

.NET Framework 4.6.1 targeting pack

.NET Portable Library targeting pack

CLR data types for SQL Server

Date sources and servic references

Class Designer

ClickOnce Publishing

Dependency Validation

Developer Analytics tools

DGML editor

Git for Windows

GitHub extension for Visual Studio

Help Viewer

NuGet package manager

Static analysis toolsText Template Transformation

C# and Visual Basic Roslyn compilers

C++/CLI support

MSBuild

VC++ 2015.3 v140 toolset (x86x64)

VC++ 2017 v141 toolset (x86x64)

Visual C++ runtime for UWP

Visual C++ tools for CMake

Windows Universal CRT SDK

C++ profiling tools

Just-In-Time debugger

Profiling tools

Testing tools core features

C# and Visual Basic

F# language support

Visual Studio C++ core features

Graphics debugger and GPU profiler for DirectX

Unreal Engine Installer

Entity Framework 6 tools

Graphics Tools Windows 8.1 SDK

Visual C++ ATL Support

Windows 10 SDK (10.0.15063.0) for Desktop C++ x86 and x64

Windows 10 SDK (10.0.15063.0) for UWP: C++

Windows 8.1 SDK

Windows Univeral C Runtime

yeah, its not about classes, its just that there is a relationship problem between UE4 4.16.1 and VS2017, whether creating a BP project or a C++ project. something to do with an input file ‘ws2_32.lib’ not loading or something.

Check this link, these people are having the same problem, I am not alone in this bug.

I am still looking for a solution here…

I had same problem. Just go download Windows SDK 8.1

This looks like the same issue I had here where Tigan2 suggested to move (move instead of delete in case something goes wrong) the BuildConfiguration.xml file out of “C:\Users\User\Documents\Unreal Engine\UnrealBuildTool”, which worked for me as well.