# Noob c++ question

**URL:** <https://forums.unrealengine.com/t/noob-c-question/1277980>\
**Category:** C++\
**Tags:** header, unreal-engine, Scripting, question, CPP\
**Created:** [August 30, 2023, 6:48pm UTC](https://forums.unrealengine.com/t/noob-c-question/1277980 "2023-08-30T18:48:59Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Antokog](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Antokog](https://forums.unrealengine.com/u/Antokog)\
**Post date:** [August 30, 2023, 6:48pm UTC](https://forums.unrealengine.com/t/noob-c-question/1277980/1 "2023-08-30T18:48:59Z")

</div>

Hello, I’m not quite familiar with C++.  
I’m trying to implement basic structures for my strategy game and I’m getting this error.  
The command ““C:\Program Files\Epic Games\UE\_5.2\Engine\Build\BatchFiles\Build.bat” … -WaitMutex -FromMsBuild” exited with code 6.  
my code:  
StrategyStateManager.h

```auto

#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"
#include "StrategyStateManager.generated.h"

UCLASS()
class CTEST_API UStrategyStateManager : public UObject
{
    GENERATED_BODY()

public:
    UStrategyStateManager();

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "States")
        TArray<TSoftObjectPtr<class UStrategyStateData>> StateReferences;
};

```

StrategyStateManager.cpp

```auto
#include "StrategyStateManager.h"
#include "StrategyStateData.h" 

UStrategyStateManager::UStrategyStateManager()
{
    // implementation
}

```

UStrategyStateData.h

```auto
#pragma once

#include "CoreMinimal.h"
#include "UObject/NoExportTypes.h"

#include "UStrategyStateData.generated.h"

UCLASS()
class CTEST_API UStrategyStateData : public UObject
{
    GENERATED_BODY()

public:
    UPROPERTY(EditAnywhere, Category = "State Data")
        bool bIsPlayerControlled;

    UPROPERTY(EditAnywhere, Category = "State Data")
        int Resources;

    
};

```

UStrategyStateData.cpp

```auto
#include "UStrategyStateData.h"

UStrategyStateData::UStrategyStateData()
{
    // implementation
}

```

---

<div class="post-metadata">

**Author:** ![GeorgieDoDa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GeorgieDoDa](https://forums.unrealengine.com/u/GeorgieDoDa)\
**Post date:** [August 30, 2023, 8:22pm UTC](https://forums.unrealengine.com/t/noob-c-question/1277980/2 "2023-08-30T20:22:03Z")

</div>

Hey, your code snippets are a little unreadable due to the formatting.  
Wrap the code between 3 backticks (3 at the start and 3 at the end, it’s the key to the left of the 1 key on the top row of numbers) and it’ll format it so it’s readable.

Make sure you’ve spelt class names correctly or not using the incorrect operator for something. If you check your Output Log in Visual Studio (or whatever IDE you’re using), there might be another issue that’s caught before this.

---

<div class="post-metadata">

**Author:** ![Antokog](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Antokog](https://forums.unrealengine.com/u/Antokog)\
**Post date:** [August 30, 2023, 8:28pm UTC](https://forums.unrealengine.com/t/noob-c-question/1277980/3 "2023-08-30T20:28:33Z")

</div>

Thanks for the formatting advice! there is only one error in log

---

<div class="post-metadata">

**Author:** ![GeorgieDoDa](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@GeorgieDoDa](https://forums.unrealengine.com/u/GeorgieDoDa)\
**Post date:** [August 30, 2023, 8:34pm UTC](https://forums.unrealengine.com/t/noob-c-question/1277980/4 "2023-08-30T20:34:15Z")

</div>

Out of interest, try disabling LIVE coding, or compiling from either the Editor itself or your IDE. Not an error I’m familiar with I’m afraid.

---

<div class="post-metadata">

**Author:** ![Antokog](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Antokog](https://forums.unrealengine.com/u/Antokog)\
**Post date:** [August 30, 2023, 8:40pm UTC](https://forums.unrealengine.com/t/noob-c-question/1277980/5 "2023-08-30T20:40:45Z")

</div>

interesting… after disabling live coding i have 3 erorrs:   
C1083 Cannot open include file: ‘StrategyStateData.h’: No such file or directory C:\Users\Admin\Documents\Unreal Projects\ctest\Source\ctest\StrategyStateManager.cpp

C2511|‘UStrategyStateData::UStrategyStateData(void)’: overloaded member function not found in ‘UStrategyStateData’|ctest|C:\Users\Admin\Documents\Unreal Projects\ctest\Source\ctest\UStrategyStateData.cpp  
and the old one  
MSB3073|The command C:\Program Files\Epic Games\UE\_5.2\Engine\Build\BatchFiles\Build.bat ctestEditor Win64 Development -Project=C:\Users\Admin\Documents\Unreal Projects\ctest\ctest.uproject -WaitMutex -FromMsBuild exited with code 6.|ctest|C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.MakeFile.Targets|44||

---

<div class="post-metadata">

**Author:** ![Antokog](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Antokog](https://forums.unrealengine.com/u/Antokog)\
**Post date:** [August 30, 2023, 8:45pm UTC](https://forums.unrealengine.com/t/noob-c-question/1277980/6 "2023-08-30T20:45:22Z")

</div>

anyway, i was interested if my syntax is right, so now i should dig into something else… Thank you for help

---

<div class="post-metadata">

**Author:** ![Antokog](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Antokog](https://forums.unrealengine.com/u/Antokog)\
**Post date:** [August 30, 2023, 9:41pm UTC](https://forums.unrealengine.com/t/noob-c-question/1277980/7 "2023-08-30T21:41:07Z")

</div>

Ok, so solution was to disable then enable live coding, then restart after that compiler showed proper information.

---

<div class="post-metadata">

**Author:** ![dzemzmcdonalda](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/dzemzmcdonalda/32/1214680_2.png) [@dzemzmcdonalda](https://forums.unrealengine.com/u/dzemzmcdonalda)\
**Post date:** [August 30, 2023, 10:17pm UTC](https://forums.unrealengine.com/t/noob-c-question/1277980/8 "2023-08-30T22:17:57Z")

</div>

This error is a common thing, and it’s not a real issue.  
It happens because you try to recompile your project via Visual Studio, while Editor is already running.

This will indeed not happen, if you haven’t used the Live Coding, but in this case you would have to reset the Editor every time after making any code change.

Instead, you should actually use the Live Coding feature to re-compile any code change.  
You can do this by pressing this button (bottom-right corner of screen):

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/7/0/7700c3e4efb1ed78f9ade8312dd35c6225ddd1be.png)

or by pressing: `Ctrl+Alt+F11`

Actually, compilation output log should have told you about this:

```auto
Unable to build while Live Coding is active. Exit the editor and game, or press Ctrl+Alt+F11 if iterating on code in the editor or game

```

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [September 29, 2023, 10:18pm UTC](https://forums.unrealengine.com/t/noob-c-question/1277980/9 "2023-09-29T22:18:03Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
