# All of my custom Debug logs are not allowing me to compile my code

**URL:** <https://forums.unrealengine.com/t/all-of-my-custom-debug-logs-are-not-allowing-me-to-compile-my-code/452324>\
**Category:** C++\
**Tags:** error, logging, unreal-engine, CPP, question, compilation-log\
**Created:** [July 15, 2019, 9:07pm UTC](https://forums.unrealengine.com/t/all-of-my-custom-debug-logs-are-not-allowing-me-to-compile-my-code/452324 "2019-07-15T21:07:28Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rosium](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rosium](https://forums.unrealengine.com/u/Rosium)\
**Post date:** [July 15, 2019, 9:07pm UTC](https://forums.unrealengine.com/t/all-of-my-custom-debug-logs-are-not-allowing-me-to-compile-my-code/452324/1 "2019-07-15T21:07:28Z")

</div>

I add

.h

Declare\_Log\_Category\_Extern(MyLog, Log, All);

.cpp

Define\_Log\_Category(MyLog);

Once i compile I get these errors:

error C2146: syntax error: missing ‘;’ before identifier ‘MyLog’

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

error C2780: ‘void FMsg::Logf\_Internal(const ANSICHAR \*,int32,const FName &,ELogVerbosity::Type,const FmtType &,Types…)’: expects 6 arguments - 4 provided

error C2065: ‘CompileTimeVerbosity’: undeclared identifier

error C2653: ‘FLogCategoryMyLog’: is not a class or namespace name

error C2065: ‘MyLog’: undeclared identifier

error C2672: ‘FMsg::Logf\_Internal’: no matching overloaded function found

error C2146: syntax error: missing ‘;’ before identifier ‘MyLog’

I already checked the wiki for Logs and print messages, that didnt help.  
Where is the proper location to declare and define a custom debug log within a script?  
Is it within the class? Outside of the class? on top, underneath the includes?

---

<div class="post-metadata">

**Author:** ![Przemek2222](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Przemek2222](https://forums.unrealengine.com/u/Przemek2222)\
**Post date:** [July 15, 2019, 9:16pm UTC](https://forums.unrealengine.com/t/all-of-my-custom-debug-logs-are-not-allowing-me-to-compile-my-code/452324/2 "2019-07-15T21:16:53Z")

</div>

Hello,

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

I’m pretty sure there is log category in a cpp.

DECLARE\_LOG\_CATEGORY\_EXTERN(CategoryName, DefaultVerbosity, CompileTimeVerbosity);

So you should invert your declaration. From CPP to H and from H to CPP.

---

<div class="post-metadata">

**Author:** ![Rosium](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rosium](https://forums.unrealengine.com/u/Rosium)\
**Post date:** [July 15, 2019, 9:29pm UTC](https://forums.unrealengine.com/t/all-of-my-custom-debug-logs-are-not-allowing-me-to-compile-my-code/452324/3 "2019-07-15T21:29:50Z")

</div>

@Przemek2222  
I tried that instead of 15 errors i get 2 sets of the same error

error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

error C2146: syntax error: missing ‘;’ before identifier ‘MyLog’

---

<div class="post-metadata">

**Author:** ![phil\_me\_up](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@phil\_me\_up](https://forums.unrealengine.com/u/phil_me_up)\
**Post date:** [July 16, 2019, 3:35pm UTC](https://forums.unrealengine.com/t/all-of-my-custom-debug-logs-are-not-allowing-me-to-compile-my-code/452324/4 "2019-07-16T15:35:37Z")

</div>

In C++, capitalisation matters. Your post suggests you’ve used

```
Declare_Log_Category_Extern(MyLog, Log, All);

```

Instead of

```
DECLARE_LOG_CATEGORY_EXTERN(MyLog, Log, All);

```

And

```
Define_Log_Category(MyLog);

```

Instead of

```
DEFINE_LOG_CATEGORY(MyLog);

```

Update to use capitals and see if that fixes the issue.

Also, My DEFINE\_LOG\_CATEGORY are in .cpp and DECLATE\_LOG\_CATEGORY\_EXTERN is in .h

---

<div class="post-metadata">

**Author:** ![Przemek2222](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Przemek2222](https://forums.unrealengine.com/u/Przemek2222)\
**Post date:** [July 17, 2019, 10:17pm UTC](https://forums.unrealengine.com/t/all-of-my-custom-debug-logs-are-not-allowing-me-to-compile-my-code/452324/5 "2019-07-17T22:17:22Z")

</div>

Macros are written all with big letters so make sure you have  
DECLARE\_LOG\_CATEGORY\_EXTERN not Declare\_Log\_Category\_Extern …

---

<div class="post-metadata">

**Author:** ![Rosium](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rosium](https://forums.unrealengine.com/u/Rosium)\
**Post date:** [July 29, 2019, 6:47pm UTC](https://forums.unrealengine.com/t/all-of-my-custom-debug-logs-are-not-allowing-me-to-compile-my-code/452324/6 "2019-07-29T18:47:52Z")

</div>

I understand, However, i still received the same errors, all caps or not ☹

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_10e9bdbd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_10e9bdbd](https://forums.unrealengine.com/u/anonymous_user_10e9bdbd)\
**Post date:** [July 29, 2019, 9:55pm UTC](https://forums.unrealengine.com/t/all-of-my-custom-debug-logs-are-not-allowing-me-to-compile-my-code/452324/7 "2019-07-29T21:55:03Z")

</div>

This is what works for me. Hopefully it will help you as well.

In your project header file (MyProject.h), add the following:

```
DECLARE_LOG_CATEGORY_EXTERN(LogMyGame, Warning, All);

```

In your project cpp file (MyProject.cpp), add the following:

```
DEFINE_LOG_CATEGORY(LogMyGame);

```

Hope this helps.

---

<div class="post-metadata">

**Author:** ![Kruul](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Kruul](https://forums.unrealengine.com/u/Kruul)\
**Post date:** [February 22, 2021, 12:38pm UTC](https://forums.unrealengine.com/t/all-of-my-custom-debug-logs-are-not-allowing-me-to-compile-my-code/452324/8 "2021-02-22T12:38:56Z")

</div>

I was having the same issue in regard to the above and the compiler didn’t like the code until the custom logs were being implemented somewhere. Intellisense doesn’t like it and it throws a red.

In the game.h:

```
DECLARE_LOG_CATEGORY_EXTERN(YourLog, Verbose, All);

```

In the game.cpp:

```
DEFINE_LOG_CATEGORY(YourLog);

```

Implementation in my character.cpp. Include the game.h:

```
UE_LOG(YourLog, Warning, TEXT("YourLog Warning"));

```

It runs and allows all variations of the custom debug message e.g. Verbose, Very Verbose etc.

Hope this helps.
