Unreal Engine 4 "project coult not be compiled" - c++

I have downloaded UE4 recently and cant get a C++ class to open. As I create the project this shows up:
Running C:/Program Files (x86)/Epic Games/4.10/Engine/Binaries/DotNET/UnrealBuildTool.exe MyProject6 Development Win64 -project="C:/Users/Daniel/Documents/Unreal Projects/MyProject6/MyProject6.uproject" -rocket -editorrecompile -progress -noubtmakefiles -2015
#progress push 5%
Parsing headers for MyProject6Editor
Running UnrealHeaderTool "C:/Users/Daniel/Documents/Unreal Projects/MyProject6/MyProject6.uproject" "C:\Users\Daniel\Documents\Unreal Projects\MyProject6\Intermediate\Build\Win64\MyProject6Editor\Development\UnrealHeaderTool.manifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -rocket -installed
Reflection code generated for MyProject6Editor in 11,6497437 seconds
#progress pop
Performing 7 actions (4 in parallel)
[2/7] Resource PCLaunch.rc
[3/7] Resource ModuleVersionResource.rc.inl
PCH.MyProject6.h.cpp
MyProject6.cpp
MyProject6GameMode.cpp
MyProject6.generated.cpp
C:\Users\Daniel\Documents\Unreal Projects\MyProject6\Source\MyProject6\MyProject6GameMode.cpp: error C4599: '/IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE': command line argument number 228 does not match precompiled headerC:\Users\Daniel\Documents\Unreal Projects\MyProject6\Source\MyProject6\MyProject6.cpp: error C4599: '/IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE': command line argument number 228 does not match precompiled header
C:\Users\Daniel\Documents\Unreal Projects\MyProject6\Intermediate\Build\Win64\UE4Editor\Inc\MyProject6\MyProject6.generated.cpp: error C4599: '/IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE': command line argument number 228 does not match precompiled header
-------- End Detailed Actions Stats -----------------------------------------------------------
ERROR: UBT ERROR: Failed to produce item: C:\Users\Daniel\Documents\Unreal Projects\MyProject6\Binaries\Win64\UE4Editor-MyProject6.dll
Total build time: 100,66 seconds
Any ideas what went wrong?
Thanks for the help.

Your game mode sourcefile is including a header that is incorrect in some way. I see a reference to line 228 but I'm unsure if that's in your game mode or in an included header.

Related

Agora.io Unreal Engine Plugin Build error

when i try to rebuild the sample or the plugin, i have some errors in the visual studio console
1-
Severity Code Description Project File Line Suppression State
Warning Library 'agora_rtc_sdk.lib' was not resolvable to a file when used in Module 'Agora', assuming it is a filename and will search library paths for it. This is slow and dependency checking will not work for it. Please update reference to be fully qualified alternatively use PublicSystemLibraryPaths if you do intended to use this slow path to suppress this warning. AgoraVideoCall C:\Users\Ahmed Hassn\Desktop\Agora-Unreal-SDK-Blueprint-master\Intermediate\ProjectFiles\UnrealBuildTool 1
2-
Severity Code Description Project File Line Suppression State
Error Expected an include at the top of the header: '#include "GameplayTagsK2Node_MultiCompareGameplayTagAssetInterfaceSingle.generated.h"' AgoraVideoCall C:\Program Files\Epic Games\UE_4.24\Engine\Plugins\Editor\GameplayTagsEditor\Source\GameplayTagsEditor\Classes\GameplayTagsK2Node_MultiCompareGameplayTagAssetInterfaceSingle.h 32
3-
Severity Code Description Project File Line Suppression State
Error MSB3073 The command ""C:\Program Files\Epic Games\UE_4.24\Engine\Build\BatchFiles\Rebuild.bat" AgoraVideoCallEditor Win64 Development -Project="C:\Users\Ahmed Hassn\Desktop\Agora-Unreal-SDK-Blueprint-master\AgoraVideoCall.uproject" -WaitMutex -FromMsBuild" exited with code -1. AgoraVideoCall C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets 49
those the three errors i got when i try to build in visual studio
in context to building the project, which of these build descriptions fit your situation?
Is this during:
the initial project opening ie: "build agora modules?"
packaging/building the project to test a standalone build.
Thanks!

Error when opening UnrealEngine

Im new to UnrealEngine but I have worked with unity before. im trying to create a new unreal engine file but I keep getting this error every time I try (Can not compile, basically):
The project could not be compiled. Would you like to open it in Visual Studio?
Running C:/Program Files/Epic Games/UE_4.10/Engine/Binaries/DotNET/UnrealBuildTool.exe test Development Win64 -project="C:/Users/abdel/Desktop/gamemaking/Unreal/BuildingEscape/test/test.uproject" -rocket -editorrecompile -progress -noubtmakefiles -2015
#progress push 5%
Parsing headers for testEditor
Running UnrealHeaderTool "C:/Users/abdel/Desktop/gamemaking/Unreal/BuildingEscape/test/test.uproject" "C:\Users\abdel\Desktop\gamemaking\Unreal\BuildingEscape\test\Intermediate\Build\Win64\testEditor\Development\UnrealHeaderTool.manifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -rocket -installed
Reflection code generated for testEditor in 7.1584488 seconds
#progress pop
Performing 8 actions (2 in parallel)
[2/8] Resource PCLaunch.rc
PCH.test.h.cpp
[3/8] Resource ModuleVersionResource.rc.inl
testGameMode.cpp
test.generated.cpp
C:\Users\abdel\Desktop\gamemaking\Unreal\BuildingEscape\test\Intermediate\Build\Win64\UE4Editor\Inc\test\test.generated.cpp: error C4599: '/IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE': command line argument number 228 does not match precompiled headerC:\Users\abdel\Desktop\gamemaking\Unreal\BuildingEscape\test\Source\test\testGameMode.cpp: error C4599: '/IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE': command line argument number 228 does not match precompiled header
testCharacter.cpp
C:\Users\abdel\Desktop\gamemaking\Unreal\BuildingEscape\test\Source\test\testCharacter.cpp: error C4599: '/IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE': command line argument number 228 does not match precompiled header
test.cpp
C:\Users\abdel\Desktop\gamemaking\Unreal\BuildingEscape\test\Source\test\test.cpp: error C4599: '/IC:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE': command line argument number 228 does not match precompiled header
-------- End Detailed Actions Stats -----------------------------------------------------------
ERROR: UBT ERROR: Failed to produce item: C:\Users\abdel\Desktop\gamemaking\Unreal\BuildingEscape\test\Binaries\Win64\UE4Editor-test.dll
Total build time: 26.15 seconds
I have visual studio downloaded and when I try to open it in Visual Studio, I get a build error.
please help :)
Please take a look at
https://docs.unrealengine.com/latest/INT/Programming/Development/VisualStudioSetup/
and check that you are using the correct Visual Studio version.
Also, is there a reason that you are using Unreal Engine 4.10 instead of the newest version, even though you are just starting with UE and, I assume, you don't have any previous projects?

Unreal Engine 4.10.1 can't compile Visual Studio 2015 project

I recently installed the most recent version of UE on my Windows 7 and made a new empty C++ project. After creating the project it gave me an error saying it failed to compile. I opened the project in VS to manually compile it and this is the output I got.
I looked online but got no answers.
EDIT: I use these headers with no issues when compiling non-UE projects.
1>------ Build started: Project: RPG, Configuration: Development_Editor x64 ------
1> Performing 7 actions (2 in parallel)
1> [2/7] Resource PCLaunch.rc
1>C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\Launch\Resources\Windows\PCLaunch.rc(10): fatal error RC1015: cannot open include file 'windows.h'.
1>
1> PCH.RPG.h.cpp
1>C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\Core\Public\HAL\PlatformIncludes.h(5): fatal error C1083: Cannot open include file: 'new': No such file or directory
1> [3/7] Resource ModuleVersionResource.rc.inl
1>C:\Program Files\Epic Games\4.10\Engine\Source\Runtime\Core\Resources\Windows\ModuleVersionResource.rc.inl(3): fatal error RC1015: cannot open include file 'windows.h'.
1>
1> -------- End Detailed Actions Stats -----------------------------------------------------------
1>ERROR : UBT error : Failed to produce item: C:\Users\Jack\Documents\Unreal Projects\RPG\Binaries\Win64\UE4Editor-RPG.dll
1> Total build time: 3.64 seconds
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(37,5): error MSB3073: The command ""C:\Program Files\Epic Games\4.10\Engine\Build\BatchFiles\Build.bat" RPGEditor Win64 Development "C:\Users\Jack\Documents\Unreal Projects\RPG\RPG.uproject" -rocket -waitmutex -2015" exited with code -1.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
The part that really confuses me is that it apparently can't open new.h and windows.h though Visual Studio has no problem opening the file when I check where they were included.
After creating an Unreal Engine project you may face errors like:
"fatal error RC1015: cannot open include file 'windows.h' "
"fatal error C1083: Cannot open include file: 'new': No such file or directory".
To fix it open your project (not EU4 project) properties/VC++ Directories.
If you see empty fileds like "Include Directories", "Library Directories" then click on the combo box on the right side and choose "inherit from parent or project defaults".
Then compile the project again.
Images below:
Default project template
Build errors
choose inherit from parent or project defaults

C++ Visual Studio 2012 issues

Updated problem #3
I've narrowed the problem. It seems that simply including <thread> makes the compiler go mad.
I am not even making any thread calls, just including it.
I have tried enabling /EHsc and also disabling it.
Disabled, I get:
I get these 6 messages:
Error 1 error C2220: warning treated as error - no 'object' file generated (main.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 313 1 cefclient
Warning 2 warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (main.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 313 1 cefclient
Error 3 error C2220: warning treated as error - no 'object' file generated (Program.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 313 1 cefclient
Warning 4 warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (Program.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 313 1 cefclient
Error 5 error C3861: '__uncaught_exception': identifier not found (main.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 4774 1 cefclient
Error 6 error C3861: '__uncaught_exception': identifier not found (Program.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 4774 1 cefclient
And if enabled (Configuration Properties -> C/C++ -> Code Generation & in the Command Line)
Error 1 error C3861: '__uncaught_exception': identifier not found (main.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 4774 1 cefclient
Error 2 error C3861: '__uncaught_exception': identifier not found (Program.cpp) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\concrt.h 4774 1 cefclient
I did a simple test with a new, blank project, including thread and just compiling. It went fine, no errors.
However in my main project I am using Chromium Embedded Framework v3, which seems to interact strangely with the thread inclusion?
Seems odd that simply including it would make such a mess.
Any ideas?
Update:
By removing the _HAS_EXCEPTIONS=0 flag entirely and rebuilding the project from CMake, I enter a state where the project won't even compile.
Due to this change it throws out a ton of warnings and errors from various files.
Errors such as:
Warning 230 warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (C:\Users\mads\Desktop\cef_binary_3.2526.1347.gcf20046_windows32\cefclient\browser\client_handler_osr.cc) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xlocale 337 1 cefclient
According to a lot of asking around and googling, the solution to this is to specify /EHsc in Project Properties -> C/C++ -> Code Generation -> Enable C++ Exceptions = Yes(/EHsc).
As well as setting the flag /EHsc in the Command Line input field.
However, nothing changes. The same errors come out as if nothing was changed.
Update:
The error
Warning 2 warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (C:\Users\mads\Desktop\cef_binary_3.2556.1368.g535c4fb_windows32\libcef_dll\transfer_util.cc) C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xlocale 337 1 libcef_dll_wrapper
comes from the project "libcef_dll_wrapper", despite the fact that I HAVE speficied /EHsc in its project settings! Both in C++ -> Code Generation page and the Command Line
Solution edit:
Turns out that cmake files would override my set settings everytime I attempted to build or run the project, hence rendering any changes I made un-used, despite being set!
I was able to solve the problem by editing the project's cmake files directly.
Never used cmake before, so in the end it became a learning experience.
I have tested my project with thread inclusion now and it compiles as expected!
Thanks to all for great suggestions
Make sure neither the code nor the compiler command line define _HAS_EXCEPTIONS=0.
Compiling VC++ 12.0 with _HAS_EXCEPTIONS=0 and including concrt.h causes a compiler error:
If a source file is compiled with VC++ 12.0 with _HAS_EXCEPTIONS set to 0 and the source includes, whether directly or indirectly, concrt.h, the compiler gives an error of:
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\concrt.h(4774) : error C3861: '__uncaught_exception': identifier not found
[...] Macro _HAS_EXCEPTIONS=0 is undocumented and unsupported by Microsoft.
It may work with some parts of the STL library for legacy reasons, but it won't be compatible with ConcRT library (concrt.h) since ConcRT depends on exceptions for cancellation.

VS2011 code analysis

I recently installed the VS2011 beta to get a feel for the new C++11 features Microsoft had implemented in the latest release of their compiler.
I've had an unexpected problem when going back to use VS2010 though. I've opened a Windows SDK 7.1 sample project in VS2010.
Now when I build in VS2010, I get the following output, denoting that a code analysis tool is being executed (seemingly after compilation, but before linking)
1>------ Rebuild All started: Project: MFCaptureToFile, Configuration: Debug Win32 ------
1> winmain.cpp
1> capture.cpp
1> Running Code Analysis for C/C++...
1>capture.cpp(112): error C2220: warning treated as error - no 'object' file generated
1>c:\program files\microsoft sdks\windows\v7.1\samples\multimedia\mediafoundation\mfcapturetofile\capture.cpp(105): warning C6309: Argument '3' is null: this does not adhere to function specification of 'IMFAttributes::GetAllocatedString'
1>c:\program files\microsoft sdks\windows\v7.1\samples\multimedia\mediafoundation\mfcapturetofile\capture.cpp(105): warning C6387: 'argument 3' might be '0': this does not adhere to the specification for the function 'IMFAttributes::GetAllocatedString': Lines: 98, 103, 105
1>c:\program files\microsoft sdks\windows\v7.1\samples\multimedia\mediafoundation\mfcapturetofile\capture.cpp(353): warning C6309: Argument '3' is null: this does not adhere to function specification of 'IMFAttributes::GetAllocatedString'
1>c:\program files\microsoft sdks\windows\v7.1\samples\multimedia\mediafoundation\mfcapturetofile\capture.cpp(353): warning C6387: 'argument 3' might be '0': this does not adhere to the specification for the function 'IMFAttributes::GetAllocatedString': Lines: 336, 338, 340, 343, 351, 353
1>C:\Program Files\Microsoft SDKs\Windows\v7.1\Include\ks.h(53): error C2220: warning treated as error - no 'object' file generated
1>c:\program files\microsoft sdks\windows\v7.1\include\ks.h(53): warning C6244: Local declaration of 'GUID_NULL' hides previous declaration at line '28' of 'c:\program files\microsoft sdks\windows\v7.1\include\cguid.h'
1> Generating Code...
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
I've attempted to determine what change to the project has caused code analysis tool to be executed, but I can't find anything in the project properties. I've tried reloading the project in VS2011, but there's no option for code analysis that I can turn off (as suggested on MSDN).
The project is completely native C++, I've never used C++ with CLR
Further, I've tried opening other projects (my own) and now they're also invoking this code analysis stage. This prevents building due to problems with Microsoft code in many cases! Builds seem to succeed in VS2011 beta.
Can anyone offer insight into how to turn this code analysis tool off? I would hope to leave VS2011 beta installed, so please refrain from suggesting uninstalling it, unless it's the only option!
I think only VS2010 Ultimate supports code analysis. I don't have VS2012 but I think you should edit the vcxproj file manually.
Look for one or both of these params if they exist inside your project file:
<RunCodeAnalysis>true</RunCodeAnalysis> and <EnablePREfast>true</EnablePREfast>
Change both values to false and it should work.
Please note that these names are used by VS2010 and I am unsure if they changed it in VS2012.