Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Access violation - code c0000005 (first/second chance not available)

I have followed these video tutorials (https://www.youtube.com/watch?v=vtcWrcscXos∈dex=1&list=PLZlv_N0_O1gb5xvsc7VM7pfoRAKLuIcFi), for getting started with coding in C++ for UE4.

The following dialog box with this message shows up when I use the DebugGame Editor solution configuration, in VS2013:

Default Property warnings and errors:![alt text][1] Error: CDO Constructor: Failed to find Engine/Content/Slate/Fonts/RobotoDistanceField

The editor still loads up the project though, I am even allowed to build the level of such, but when I hit play or simulate, VS2013 throws up an Unhandled exception as informed to me by VS2013 here:

Unhandled exception at 0x000007FEDC1DE90D (UE4Editor-CodedThirdPersonTest-Win64-DebugGame.dll) in UE4Editor.exe: 0xC0000005: Access violation reading location 0x0000000000000440

If I load up the project from the launcher, I do not get the dialog box, that says that it failed to find the font I am using, I can even build the project without crashes as well, but when I hit play or simulate, the editor crashes and gives a crash report dialog box, with the following message in the CallStack:

 Access violation - code c0000005 (first/second chance not available)
 Fatal error!
 UE4Editor_CodedThirdPersonTest_7476!ACodedThirdPersonTestHUD::DrawHUD() + 294 bytes [c:\users\james moran\documents\unreal projects\codedthirdpersontest\source\codedthirdpersontest\private\codedthirdpersontesthud.cpp:36]
 UE4Editor_Engine + 4278977 bytes
 UE4Editor_Engine + 3434988 bytes
 UE4Editor_Engine + 8422933 bytes
 UE4Editor_UnrealEd + 1816980 bytes
 UE4Editor_UnrealEd + 5925286 bytes
 UE4Editor!FEngineLoop::Tick() + 3294 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.4\engine\source\runtime\launch\private\launchengineloop.cpp:2098]
 UE4Editor!GuardedMain() + 476 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.4\engine\source\runtime\launch\private\launch.cpp:133]
 UE4Editor!GuardedMainWrapper() + 26 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.4\engine\source\runtime\launch\private\windows\launchwindows.cpp:125]
 UE4Editor!WinMain() + 249 bytes [d:\buildfarm\buildmachine_++depot+ue4-releases+4.4\engine\source\runtime\launch\private\windows\launchwindows.cpp:201]
 UE4Editor!__tmainCRTStartup() + 329 bytes [f:\dd\vctools\crt\crtw32\dllstuff\crtexe.c:618]

This project was created with version 4.4.3, and version 4.4.3 is used to load the project from the launcher.

I have also loaded other projects of mine and none of them get this crash error.

Edit: As of today, the 19/10/2014, I have also created a new third person code project, built it, and that runs just fine, no errors, no crashes, which could very well mean that there could be a fault with my code, or VS2013, a link to a zip of the source is here: https://dl.dropboxusercontent.com/u/109608967/Source.zip

I was not getting this crash before adding text to the HUD, the base HUD class did not cause any crashes or compilation errors, but trying to draw text to the HUD canvas, did cause the popup, that occurs when I ran the DebugGame Editor solution configuration (failed to find), then trying to run or simulate the default level, with this gamemode, causes the crash as detailed above.

Edit as of 20/10/2014: I have managed to narrow down the error to this if statement, not the code within the if statement, but the line MyGameMode->GetCurrentGameState() at the start of the if statement, throws up the access violated error (when the solution is built, with this line commented out, I can play the game in the editor, no crashes).

 if (/*MyGameMode->GetCurrentGameState() ==*/ ACodedThirdPersonTestGameMode::ECodedThirdPersonTestPlayState::EGameOver)
         // Create a varible for storing the size of printing Game Over
         FVector2D GameOverSize;
         GetTextSize(TEXT("GAME OVER"), GameOverSize.X, GameOverSize.Y, HUDFont);
         DrawText(TEXT("GAME OVER"), FColor::White, (ScreenDimensions.X - GameOverSize.X) / 2.0f, (ScreenDimensions.Y - GameOverSize.Y) / 2.0f, HUDFont);

I have even changed the Enum, from being part of a namespace, to being a UENUM, of the ACodedThirdPersonTestGameMode class declaration, in the header file of ACodedThirdPersonTestGameMode, as shown below:

 class ACodedThirdPersonTestGameMode : public AGameMode
     virtual void Tick(float DeltaSeconds) override;
     // This is the enum to store the current state of gameplay
     enum ECodedThirdPersonTestPlayState

Edit as of 3 hours after the first edit on 20/10/2014:

I have changed my enum to be assigned a value on declaration as so:

ECodedThirdPersonTestPlayState CurrentGameState = ECodedThirdPersonTestPlayState::EPlaying; (This is in the CodedThirdPersonTestGameMode.h file)

I have also edited the GetCurrentStateFunction () to this, to try and make sure it is not a null pointer: (It is declared in the header file as: ECodedThirdPersonTestPlayState GetCurrentGameState();)

 ACodedThirdPersonTestGameMode::ECodedThirdPersonTestPlayState ACodedThirdPersonTestGameMode::GetCurrentGameState() 
     if (!CurrentGameState)
         return ACodedThirdPersonTestGameMode::ECodedThirdPersonTestPlayState::EUnknown;
         return CurrentGameState;

Doing both of these changes, still cause the access violation error to occur once again.

Edit as of 21/10/2014: I have tried to get the value on the enum,so that I can see it in debug mode, by making the variable public, this is what is shown now:


Even though I assign a value to the CurrentGameState variable, in the ThirdPersonTestGameMode.cpp file, it is still seen as having a value of '???', after that breakpoint, continuing on still causes the same errors to occur.

Product Version: Not Selected
more ▼

asked Oct 18 '14 at 03:36 PM in C++ Programming

avatar image

22 9 10 12

avatar image Tim C ♦♦ STAFF Oct 20 '14 at 10:19 PM

Hi FioKron,

I just wanted to clarify a few things regarding this issue:

  1. Are you using the binary version of the Engine installed by the Launcher, or did you build the Engine using source code?

  2. At what point in the videos did the errors start to occur? Had you completed the entire tutorial?

  3. Am I correct in understanding that your original project had only started crashing when you upgraded it to 4.5?

avatar image FioKron Oct 21 '14 at 09:54 AM

I am using the binary version of the engine installed by the launcher.

The errors started to occur when I put the code, as detailed by this tutorial: https://www.youtube.com/watch?v=yCqsbXS9yRg∈dex=18&list=PLZlv_N0_O1gb5xvsc7VM7pfoRAKLuIcFi, starting at 3:37 in the video, in ACodedThirdPersonTestHUD (my version of the HUD class from that tutorial), the errors occur soon after this, I have completed the entire project though and all I have to do to stop the errors from occuring, is comment out this line: MyGameMode->GetCurrentGameState() , then the game will work as shown, in the final tutorial of that series of tutorials.

The project crashed even before I updated to 4.5.0, I tried to see if copying the project to 4.5 would resolve this problem (I have both a 4.5.0 and a 4.3.3 version of this project, based on those tutorials), but this did not resolve this, as stated before, MyGameMode->GetCurrentGameState() is the line that seems to cause problems, the enum cannot be returned via the GetCurrentGameState() function, I am not sure why this is.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hi FioKron,

I spent some time today going through the tutorial to the point where you ran into problems, and was unable to reproduce the problem. So I took a closer look at your source code, and I think I might have spotted where things are going wrong. In your CodedThirdPersonTestHUD.cpp file, line 34, you have:

 ACodedThirdPersonTestGameMode* MyGameMode = Cast<ACodedThirdPersonTestGameMode>(UGameplayStatics::GetPlayerPawn(this, 0));

Instead, try using this line:

 ACodedThirdPersonTestGameMode* MyGameMode = Cast<ACodedThirdPersonTestGameMode>(UGameplayStatics::GetGameMode(this));

It looks like it may have been a copy-paste error from line 28. The second line is how I have it in my project and it works. I have not tried making that change in the code you provided yet, but if you try it and it doesn't help, let me know and I will do some more testing in the morning.

more ▼

answered Oct 21 '14 at 10:48 PM

avatar image FioKron Oct 22 '14 at 10:50 AM

This certainly cause the crash to not happen, many thanks indeed Tim, I am sorry that this was such a simple error, I should have noticed that the types would not have matched up, as a gamemode is not a pawn, I should certainly be far more careful in the future, many thanks once again.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question