[UE4 error]The project could not be compiled. Would you like to open it in Visual Studio? - c++

I saw many many people ask this question and apparently there is no absolute answer to this question.
this happened for me when I uninstall my visual studio 2015 cause unreal 4.18 no matter I do use VS 2015 and I want to use 2017 and I saw some people solve this problem with uninstalling VS 2015.
when I uninstall VS 2015 receive this error when I want to create a new C++ project:
The project could not be compiled. Would you like to open it in Visual Studio?
Running f:/Program Files/Epic Games/UE_4.19/Engine/Binaries/DotNET/UnrealBuildTool.exe MyProject451 Development Win64 -project="F:/c++ New/New folder/MyProject451/MyProject451.uproject" -editorrecompile -progress -NoHotReloadFromIDE
Performing full C++ include scan (building a new target)
Creating makefile for MyProject451 (no existing makefile)
#progress push 5%
Parsing headers for MyProject451Editor
Running UnrealHeaderTool "F:\c++ New\New folder\MyProject451\MyProject451.uproject" "F:\c++ New\New folder\MyProject451\Intermediate\Build\Win64\MyProject451Editor\Development\MyProject451Editor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
Reflection code generated for MyProject451Editor in 7.2801937 seconds
#progress pop
Performing 9 actions (4 in parallel)
[2/9] Resource ModuleVersionResource.rc.inl
[3/9] Resource PCLaunch.rc
SharedPCH.Engine.cpp
MyProject451GameModeBase.cpp
MyProject451.init.gen.cpp
MyProject451.cpp
MyProject451GameModeBase.gen.cpp
[8/9] Link UE4Editor-MyProject451.dll
[9/9] Link UE4Editor-MyProject451.lib
LINK : fatal error LNK1181: cannot open input file 'ws2_32.lib'
Creating library F:\c++ New\New folder\MyProject451\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyProject451.lib and object F:\c++ New\New folder\MyProject451\Intermediate\Build\Win64\UE4Editor\Development\UE4Editor-MyProject451.exp
ERROR: UBT ERROR: Failed to produce item: F:\c++ New\New folder\MyProject451\Binaries\Win64\UE4Editor-MyProject451.dll
Total build time: 34.18 seconds (Local executor: 0.00 seconds)
image of error (i copy notes in above as you can see ):enter image description here
many peoples mention its relate to Windows SDK and there is windows SDK in installing if I add more let me know.
enter image description here
I thought if I install unreal 4.19 its maybe get fixed but it didn't.
it seens ue4 genrate C++ files for VS 2015.
enter image description here
I hope there is anyone known how to solve this problem and guide me how.

I fix it with downloading this cleaner form this link https://github.com/Microsoft/VisualStudioUninstaller/releases .
after that UE4 when you want to create new project sends a message and it says you don't have VS2017 don't panic just download the installer and modify it after that it downloading about 350 mg and after that, everything will get fixed.
for more info :
https://answers.unrealengine.com/questions/597939/new-c-project-fails-to-compile-using-ue-415-and-vs.html

Related

Unreal Engine 4.27.2 is not creating C++ project

The project could not be compiled. Would you like to open it in Visual Studio Code?
Running Mono...
Found mono via known Mono.framework path
Running system mono/msbuild, version: Mono JIT compiler version 6.12.0.182 (2020-02/6051b710727 Tue Jun 14 15:01:21 EDT 2022)
/Users/Shared/Epic Games/UE_4.27/Engine /Users/Shared/Epic Games/UE_4.27/Engine/Binaries/Mac
Creating makefile for MyProject5Editor (no existing makefile)
#progress push 5%
Parsing headers for MyProject5Editor
Running UnrealHeaderTool "/Users/apple/Documents/Unreal Projects/MyProject5/MyProject5.uproject" "/Users/apple/Documents/Unreal Projects/MyProject5/Intermediate/Build/Mac/x86_64/MyProject5Editor/Development/MyProject5Editor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -abslog="/Users/apple/Library/Application Support/Epic/UnrealBuildTool/Log_UHT.txt" -installed
2022-07-15 02:15:18.637 UnrealHeaderTool[72641:1404893] [UE4] Looking for binary: ../../../Engine/Programs/UnrealHeaderTool/Config/BinaryConfig.ini
LogInit: Display: Loading text-based GConfig....
Reflection code generated for MyProject5Editor in 5.5839518 seconds
#progress pop
Building MyProject5Editor...
Performing 7 actions (5 in parallel)
[1/7] Compile SharedPCH.Engine.ShadowErrors.h
In file included from /Users/apple/Documents/Unreal Projects/MyProject5/Intermediate/Build/Mac/x86_64/MyProject5Editor/Development/Engine/SharedPCH.Engine.ShadowErrors.h:284:
In file included from /Users/Shared/Epic Games/UE_4.27/Engine/Source/Runtime/Engine/Public/EngineSharedPCH.h:572:
/Users/Shared/Epic Games/UE_4.27/Engine/Source/Runtime/Engine/Classes/Materials/Material.h:1279:26: error: variable 'LayerNames' set but not used [-Werror,-Wunused-but-set-variable]
const TArray<FText>* LayerNames = &LayersExpression->GetLayerNames();
^
1 error generated.
Well you could just pass the actual error which is
error: variable 'LayerNames' set but not used [-Werror,-Wunused-but-set-variable]
and google would quickly show you this:
https://forums.unrealengine.com/t/layernames-error-bricking-my-mac-projects/508040
According to this post:
Downloading and replacing Xcode 13.3 with Xcode 13.2.1 fixes the issue
https://download.developer.apple.com/Developer_Tools/Xcode_13.2.1/Xcode_13.2.1.xip

Why doesn't the c++ file run in visual studio

So I tried making a basic game on the console using screen buffers, I was able to create it and make a square move in the canvas, but for my next project I looked up a website with the ASCII characters and pasted a couple into a comment at the end of the c++ file, when I ran the file visual studio prompted:
I clicked yes and it didn't run anymore.
Also I recently have installed an extension for visual studio (before it didn't run, the extension works fine but I don't know if the extension may have caused this as I didn't tried running it with the extension downloaded and applied), when I open visual studio and open a file it says:
The last record in the ActivityLog xml file, has a type of error and it's description is:
Microsoft.VisualStudio.Composition.CompositionFailedException: Expected 1 export(s) with contract name "Microsoft.VisualStudio.CppSvc.Internal.CodeAnalysis.ICodeAnalysisService" but found 0 after applying applicable constraints.
at Microsoft.VisualStudio.Composition.ExportProvider.GetExports(ImportDefinition importDefinition)
at Microsoft.VisualStudio.Composition.ExportProvider.GetExports[T,TMetadataView](String contractName, ImportCardinality cardinality)
at
Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T,TMetadataView](String contractName)
at
Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T](String contractName)
at
Microsoft.VisualStudio.Composition.ExportProvider.GetExportT
at
Microsoft.VisualStudio.Composition.ExportProvider.GetExportedValueT
at Microsoft.VisualStudio.ComponentModelHost.ComponentModel.GetServiceT
at Microsoft.VisualStudio.VC.ManagedInterop.<>c.<Initialize>b__52_15()
at
System.Lazy`1.CreateValue()
at
System.Lazy`1.LazyInitValue()
at
System.Lazy`1.get_Value()
at
Microsoft.VisualStudio.VC.CodeAnalysis.ResultTaggerProvider.CreateTagger[T](ITextBuffer buffer)
at
Microsoft.VisualStudio.Text.Tagging.Implementation.TagAggregator`1.GatherTaggers(ITextBuffer textBuffer)
--- End of stack trace from previous location where exception was thrown ---
at
Microsoft.VisualStudio.Telemetry.WindowsErrorReporting.WatsonReport.GetClrWatsonExceptionInfo(Exception exceptionObject)
I have Visual Studio 2017
So why does running the file (with the local windows debugger button) say that there were build errors? And how can I fix it?
When it prompts the build error, and I click no it usually shows the errors but in this case it doesn't, yes will just run the last "successful" build (although I haven't changed the file since I have finished it before this error message started popping up)
Also there is no error in my code as I was able to run it before the build error kept appearing and I haven't touched the file since(only now to show the problems are)
Thanks for your time! if anything was unclear because of my English, comment and I'll try to clarify it
I fixed the error by deleting ComponentModelChache folder located at:
C:\Users\%userName%\AppData\Local\Microsoft\VisualStudio\15.0
15.0 is the version of your visual studio so it varies depending on the version you're using, %userName% is a replacement for the user you're logged in as

Trying to create a gRPC project using Visual Studio 2017 but running into E0145

I successfully followed this tutorial on Linux: https://grpc.io/docs/quickstart/cpp/
( gRPC version: v1.28.1 )
Then I changed the helloworld.proto file and regenerated the grpc.pb.cc, pb.cc, grpc.pb.h, pb.h files.
Then I copied those files to a Windows 10 machine with Visual Studio 2017.
I used vcpkg to install grpc. (Holy cow, this step took 45 minutes... )
I started a new console project and added the helloworld example code.
The project magically seems to find the grpc include files.
But the IDE has 175 errors when I try to compile the project with the majority being E0145.
For example:
E0145 Member "google::protobuf::Any::kIndexInFileMessages" may not be initialized.
I tried turning off precompiled headers. But to no avail.
Does anyone have an idea how I can get this running ?
You can Try this links:
Answer by "developercommunity" form
"A fix for this issue has been released! Please install the Visual Studio 2019 RC from https://visualstudio.microsoft.com/downloads/ . Thank you for providing valuable feedback which has helped improve the product."
.
Answer by "stackoverflow" form
"I fixed the first three errors (E0145) by #define BOOST_FILESYSTEM_SOURCE in my application. The last error (E2512) remains. It occurs in the following code: #define BOOST_SYSTEM_REQUIRE_CONST_INIT #if defined(__has_cpp_attribute) #if __has_cpp_attribute(clang::require_constant_initialization) # undef BOOST_SYSTEM_REQUIRE_CONST_INIT # define BOOST_SYSTEM_REQUIRE_CONST_INIT [[clang::require_constant_initialization]] #endif #endif – pras123"

Error compiling Unreal Engine 4.24.1 after updating visual studio 2019

I'm having a weird error after updating Visual Studio 2019 Community from v16.4.5 to 16.5. Even a fresh install of the engine will no longer build. I'm getting the errors listed below. The build doesn't fail until the end of compiling all modules:
Error C4800 Implicit conversion from 'ADODB::_Recordset *const ' to bool. Possible information loss UE4 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\INCLUDE\comip.h 311
Error C4800 Implicit conversion from 'ADODB::_Connection *const ' to bool. Possible information loss UE4 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\INCLUDE\comip.h 311
Error MSB3075 The command "..\..\Build\BatchFiles\Build.bat -Target="UE4Editor Win64 Development" -Target="ShaderCompileWorker Win64 Development -Quiet" -WaitMutex -FromMsBuild" exited with code 5. Please verify that you have sufficient rights to run this command. UE4 C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.MakeFile.Targets 44
I have not changed or updated anything on the Unreal Engine-side of the code. This error occurs during a build of UE4.sln, sourced from Epic's github repo. The build doesn't fail until all modules are built (it fails at the end of the build).
Seeing as Microsoft doesn't have archives of installers for VS Community, only Enterprise and Pro, I'm kind of suddenly stuck here because I can't just uninstall 16.5 and reinstall 16.4.5 (which is the last working version I was on before the update).
I heard sometimes setting "treat warnings as errors" to false can help, but I don't see a way to do that in Visual Studio.
Any insight into this would be helpful, Thanks!
So, turns out something changed on VS2019's side in the update from 16.4.5 to 16.5, but the fix for UE4 can be found in this commit on the 4.25 branch. Confirmed that this solved my problem!
First Make a backup of your whole project (just copy it to somewhere else).
Afterwards delete the following folders in the project directory:-
.vs
Intermediate
Saved
you just need to delete the .vs folder to solve the problem. The rest are just for a quick refresh of your project.
Next open Unreal Engine 4, then under File tab click on Refresh Visual Studio Project. On completion try to compile again. This should solve your problem.
For those who facing the same problem, here is the solution.
Step 1:
open the file ADOSupport.cpp on [YourEngineSourceDir]\Engine\Plugins\Runtime\Database\ADOSupport\Source\ADOSupport\Private
Step 2:
go to line 255 and modify it
from if(ADORecordSet && (ADORecordSet->State & ADODB::adStateOpen))
to if(ADORecordSet != nullptr && (ADORecordSet->State & ADODB::adStateOpen))
Step 3:
got to line 328 and modify it from if( DataBaseConnection && (DataBaseConnection->State & ADODB::adStateOpen)) to if( DataBaseConnection != nullptr && (DataBaseConnection->State & ADODB::adStateOpen))
Step 4: Build the solution and enjoy!
You should add the new line of code, like on the video tutorial:
Arguments.Add("/wd4800"); // 4800: Implicit conversion from 'type' to bool. Possible information
https://youtu.be/KXIv4y51fyw
That fix me that issue.
I had the same issue, and this solved it:
File Path
YOURENGINEPASS\Engine\Source\Programs\UnrealBuildTool\Platform\Windows
File to change
VCToolChain.cs
After line 456 add the following line:
Arguments.Add("/wd4800"); // 4800: Implicit conversion from 'type' to bool. Possible information

MSB4018 The "ResolveComReference" task failed unexpectedly

I am currently trying to upgrade our c++ mfc solution from visual studio 2010 to a visual studio 2013 solution. When i try to build it i get the error MSB4018 The "ResolveComReference" task failed unexpectedly. I enabled fusion logging and this is what it tells me:
=== Pre-bind state information ===
LOG: DisplayName = System
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: System | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Program Files (x86)/MSBuild/12.0/bin/
LOG: Initial PrivatePath = NULL
Calling assembly : Microsoft.Build.Tasks.v12.0, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a. ===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\MSBuild\12.0\bin\MSBuild.exe.Config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System/System.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/MSBuild/12.0/bin/System/System.EXE.
I understand that msbuild has been moved, but i dont understand why it is trying to find System.dll in the msbuild path, how can i make it look for it in its proper location?
Edit:
I have now also tried upgrading to visual studio 2012 which worked without bigger problems and I did not run into the same problem. However i noticed that when running devenv /upgrade (with vs2013) it seems to completely change everything under vc++ directories (it stayed unchanged when upgrading to vs2012). Could this have something to do with this issue?
Edit2:
Tried to build the project in vs2013 after upgrading it to 2012 (without running devenv /upgrade), this also didnt work so I guess the problem is not related to that...
After enabling diagonostic build output i found that it was 3 broken COM references in the project that where failing to load. Removing these references solved the building issue. These where only showing up as warnings in vs2010 but resulted in MSB4018 in vs 2013 for some reason.
This is your problem:
LOG: Appbase = file:///C:/Program Files (x86)/MSBuild/12.0/bin/
Fix the base folder in your build system if you really need it to point to another filder. However it would probably be better to redo you build system targeting 2013 instead of patching the 2010 version.