Hello all, and sorry for my bad english.
I trying complite this tutorial https://docs.unrealengine.com/latest/INT/Programming/Tutorials/VariablesTimersEvents/1/index.html. But I get a lot of erros. I just copy-paste code from tutorial. I don’t know why i get this errors, please id need youre help = ). I use UE 4.16.2 and VS Comunity 2017
image_1
image_2
The red squiggles are just Intellisense. Ignore it, especially in your first image - Intellisense is terrible with Macros.
Copy and Paste the errors you get when you try and compile.
This i get when trying build project:
[spoiler]
1>------ Build started: Project: SideAdventure, Configuration: Development_Editor x64 ------
1>Compiling game modules for hot reload
1>Parsing headers for SideAdventureEditor
1> Running UnrealHeaderTool "D:\UE_Project\SideAdventure\SideAdventure.uproject" "D:\UE_Project\SideAdventure\Intermediate\Build\Win64\SideAdventureEditor\Development\SideAdventureEditor.uhtmanifest" -LogCmds="loginit warning, logexit warning, logdatabase error" -Unattended -WarningsAsErrors -installed
1>Reflection code generated for SideAdventureEditor in 2.7646496 seconds
1>Performing 4 actions (4 in parallel)
1>SideAdventure.generated.cpp
1>Countdown.cpp
1>d:\ue_project\sideadventure\source\sideadventure\Countdown.h(28): error C2143: syntax error: missing ';' before '*'
1>d:\ue_project\sideadventure\source\sideadventure\Countdown.h(28): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>d:\ue_project\sideadventure\source\sideadventure\Countdown.h(28): error C2238: unexpected token(s) preceding ';'
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(12): error C2065: 'CountdownText': undeclared identifier
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(12): error C2065: 'UTextRenderComponent': undeclared identifier
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(12): error C2672: 'UObject::CreateDefaultSubobject': no matching overloaded function found
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(12): error C2974: 'UObject::CreateDefaultSubobject': invalid template argument for 'TReturnType', type expected
1>D:\UEngine\UE_4.16\Engine\Source\Runtime\CoreUObject\Public\UObject/Object.h(95): note: see declaration of 'UObject::CreateDefaultSubobject'
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(13): error C2065: 'CountdownText': undeclared identifier
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(13): error C2227: left of '->SetHorizontalAlignment' must point to class/struct/union/generic type
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(13): note: type is 'unknown-type'
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(13): error C2065: 'EHTA_Center': undeclared identifier
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(14): error C2065: 'CountdownText': undeclared identifier
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(14): error C2227: left of '->SetWorldSize' must point to class/struct/union/generic type
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(14): note: type is 'unknown-type'
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(15): error C2065: 'CountdownText': undeclared identifier
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(38): error C2065: 'CountdownText': undeclared identifier
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(38): error C2227: left of '->SetText' must point to class/struct/union/generic type
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(38): note: type is 'unknown-type'
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(57): error C2065: 'CountdownText': undeclared identifier
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(57): error C2227: left of '->SetText' must point to class/struct/union/generic type
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(57): note: type is 'unknown-type'
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(62): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.cpp(62): error C2146: syntax error: missing ';' before identifier 'Step'
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.h(28): error C2143: syntax error: missing ';' before '*'
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.h(28): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:\UE_Project\SideAdventure\Source\SideAdventure\Countdown.h(28): error C2238: unexpected token(s) preceding ';'
1>ERROR : UBT error : Failed to produce item: D:\UE_Project\SideAdventure\Binaries\Win64\UE4Editor-SideAdventure-1374.dll
1>Total build time: 6.03 seconds (Local executor: 0.00 seconds)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: The command "D:\UEngine\UE_4.16\Engine\Build\BatchFiles\Build.bat SideAdventureEditor Win64 Development "D:\UE_Project\SideAdventure\SideAdventure.uproject" -waitmutex" exited with code 5. Please verify that you have sufficient rights to run this command.
1>Done building project "SideAdventure.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
[/spoiler]
You need to add:
#include "Components/TextRenderComponent.h"
To your header file.
Thanks for the help! Your advice has helped!
For those who encounter the same problem… Use UnrealVS to build the project! It shows the correct compilation errors.
And when you including libraries to YourClass.h, the last file should be YourClass.generated.h. And in YourClass.cpp first file should be includet YourClass.h