C++ classes compile in Visual Studio, but Unreal crashes on opening line

Hi everyone,
I’ve got this crash problem I can’t get my head around. I foolishly didn’t try to compile frequently enough while writing my c++ class and now get this crash report.
The project worked before I added the caveMesh class to MyActor.cpp.
Visual Studio will compile it, but Unreal can’t open it, saying this:

Unknown exception - code 00000001 (first/second chance not available)

"Fatal error: [File:D:\BuildFarm\buildmachine_++depot+UE4-Releases+4.9\Engine\Source\Runtime\CoreUObject\Private\UObject\UObjectGlobals.cpp] [Line: 2066]
UObject()

UE4Editor_Core!FDebug::AssertFailed() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\core\private\misc\outputdevice.cpp:354]
UE4Editor_CoreUObject!UObject::UObject() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\coreuobject\private\uobject\uobjectglobals.cpp:2067]
UE4Editor_Engine!AActor::AActor() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\engine\private\actor.cpp:48]
UE4Editor_ProceduralMesh!AMyActor::AMyActor() [c:\users\invate\documents\unreal projects\proceduralmesh\source\proceduralmesh\myactor.cpp:9]
UE4Editor_ProceduralMesh!ACaveManager::ACaveManager() [c:\users\invate\documents\unreal projects\proceduralmesh\source\proceduralmesh\cavemanager.cpp:9]

UE4Editor_CoreUObject!UClass::CreateDefaultObject() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\coreuobject\private\uobject\class.cpp:2657]
UE4Editor_CoreUObject!UObjectLoadAllCompiledInDefaultProperties() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:729]
UE4Editor_CoreUObject!ProcessNewlyLoadedUObjects() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\coreuobject\private\uobject\uobjectbase.cpp:815]
UE4Editor_CoreUObject!TBaseStaticDelegateInstance<void cdecl(void)>::ExecuteIfSafe() [d:\buildfarm\buildmachine++depot+ue4-releases+4.9\engine\source\runtime\core\public\delegates\delegateinstancesimpl_variadics.inl:921]
UE4Editor_Core!TBaseMulticastDelegate<void>::Broadcast() [d:\buildfarm\buildmachine
++depot+ue4-releases+4.9\engine\source\runtime\core\public\delegates\delegatesignatureimpl_variadics.inl:809]
UE4Editor_Core!FModuleManager::LoadModuleWithFailureReason() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\core\private\modules\modulemanager.cpp:426]
UE4Editor_Projects!FModuleDescriptor::LoadModulesForPhase() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\projects\private\moduledescriptor.cpp:370]
UE4Editor_Projects!FProjectManager::LoadModulesForProject() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\projects\private\projectmanager.cpp:53]
UE4Editor!FEngineLoop::LoadStartupModules() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\launch\private\launchengineloop.cpp:1989]
UE4Editor!FEngineLoop::PreInit() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\launch\private\launchengineloop.cpp:1495]
UE4Editor!GuardedMain() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\launch\private\launch.cpp:110]
UE4Editor!GuardedMainWrapper() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\launch\private\windows\launchwindows.cpp:126]
UE4Editor!WinMain() [d:\buildfarm\buildmachine_++depot+ue4-releases+4.9\engine\source\runtime\launch\private\windows\launchwindows.cpp:200]
What stands out for me is that the two lines related to my own code both crash on line 9, which is the first opening curly brace in both cases. Usually with these crashes I’ve been able to figure out the problem based on which line crashed, but no such luck this time.
I’ve attached both of those files and their headers, and the related Grid50 files too.
Thanks to anyone who’s able to shed some light on this.

This might be a longshot, but your code is formatted a little oddly here:



UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = General) UProceduralMeshComponent* mesh;
	USphereComponent* SphereComponent;


I can see how this might compile in VS and bug out in the UE4 editor, but I haven’t tested something like that.
I would change it to:



UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = General)
UProceduralMeshComponent* mesh;

UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = General)
USphereComponent* SphereComponent;


Hi GeneticSpartan,
I tried the changes you suggested but i still get the same crash error after cleaning and rebuilding.

Ah! found the problem. I was constructing AMyActor PMesh instead of doing AMyActor* PMesh. facepalm