You should have some more details about why the build failed in the Output Log (Window → Developer Tools → Output Log), or your log file if you’ve since closed the editor (YourProject/Saved/Logs).
Could you post that here (or just attach your log), as that will help us know why your build is failing.
I encountered a really annoying problem. What I do is the following:
o Create a new C++ project based on ‘Vehicle base’ template
o From “File” menu → Adding code to project
o Selecting “Show all classes” and click on SceneCapture2D
o I name my class as “TestSceneCapture2D” and push “Create class”
However it gives an error “Compilation failed” because “This name is already used by another class” which is obviously not true since I started from a brand new C++ template project.
Thanks very much for the prompt answer. Yes, here it is the build log, however it does not mean too much for me… it seems that UE4 cannot compile the code its generated itself. The error list is too long to post here, but I post the first few line…
Thanks again,
G
CompilerResultsLog: Info TestSceneCapture2D.cpp
CompilerResultsLog:Error: Error C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Classes\Camera/CameraActor.h(11) : error C2504: ‘AActor’ : base class undefined
CompilerResultsLog:Error: Error C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Classes\Camera/CameraActor.h(11) : error C2504: ‘AActor’ : base class undefined
CompilerResultsLog:Error: Error C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Classes\Camera/CameraActor.h(18) : error C2653: ‘EAutoReceiveInput’ : is not a class or namespace nameC:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Classes\Camera/CameraActor.h(18) : error C2653: ‘EAutoReceiveInput’ : is not a class or namespace name
CompilerResultsLog: Info
CompilerResultsLog:Error: Error C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Classes\Camera/CameraActor.h(18) : error C2065: ‘Type’ : undeclared identifierC:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Classes\Camera/CameraActor.h(18) : error C2065: ‘Type’ : undeclared identifier
CompilerResultsLog: Info
CompilerResultsLog:Error: Error C:\Program Files\Epic Games\4.7\Engine\Source\Runtime\Engine\Classes\Camera/CameraActor.h(18) : error C2923: ‘TEnumAsByte’ : ‘Type’ is not a valid template type argument for parameter 'TEn
I’ve gotten this nonsense a lot before (seems that adding code via the Unreal Editor is buggy, especially for projects using perforce (read only files)) and switched to adding my code through visual studio and it stopped.
3 basic ways to add c++ classes and code to a UE4 project:
Through the Unreal editor (i.e. File-> New C++ Class)
Via your IDE. For me: In Visual Studios in the Solution Explorer: Right click on your project → Add → new Item (add a header and a cpp (if needed))
Manually create the files and refresh your Visual Studios project (i.e. in the unreal editor: file-> refresh visual studio project), or find your projects .uproject file (in windows) and right click-> generate visual studio project files
Thanks for your answer… yes, this is the situation. I will also change to adding code via Visual Studio, since adding code via Editor crashes a lot of time, it is really annoying.
Cheers,
G
But adding new code trhough VS manuall is more difficult since one has to know all the inheritance and U* stuff - which is otherwise generated by the Editor - to manually create a class… Or there is a simple way to know that ?
I’ve upgraded to 4.8.2 and the issue is still there. Adding SceneCapture2D to a brand new clean project gives the following error:
Info Compiling game modules for hot reload
Info Performing 2 actions (4 in parallel)
Info MySceneCapture2D.cpp
Error c:\program files\epic games\4.8\engine\source\runtime\engine\classes\engine\SceneCapture.h(13) : error C2504: ‘AActor’ : base class undefined
Error c:\program files\epic games\4.8\engine\source\runtime\engine\classes\engine\SceneCapture.h(14) : error C3668: ‘ASceneCapture::_getUObject’ : method with override specifier ‘override’ did not override any base class methods
Error c:\program files\epic games\4.8\engine\source\runtime\engine\classes\engine\SceneCapture.h(14) : error C2440: ‘return’ : cannot convert from ‘ASceneCapture *’ to ‘UObject *’
Info Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error C:\Program Files\Epic Games\4.8\Engine\Source\Runtime\Engine\Classes\Engine/SceneCapture2D.h(30) : error C3668: ‘ASceneCapture2D::PostActorCreated’ : method with override specifier ‘override’ did not override any base class methods
Error C:\Program Files\Epic Games\4.8\Engine\Source\Runtime\Engine\Classes\Engine/SceneCapture2D.h(15) : error C2440: ‘return’ : cannot convert from ‘ASceneCapture2D *’ to ‘UObject *’
Info Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error c:\users\gergely\documents\unreal projects\alma\source\alma\MySceneCapture2D.h(14) : error C2440: ‘return’ : cannot convert from ‘AMySceneCapture2D *’ to ‘UObject *’
Info Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Info -------- End Detailed Actions Stats -----------------------------------------------------------
Info ERROR: UBT ERROR: Failed to produce item: C:\Users\Gergely\Documents\Unreal Projects\Alma\Binaries\Win64\UE4Editor-Alma-6049.dll
Info Total build time: 16,11 seconds