C++ function error? MY FIRST Created class

No idea what to do. Please help me. please help me with two last errors :/.

Hey,

If you look in the build output (the bottom half of the screen) you see 4 errors. Two of them are on line 12 (which I can’t see in your screenshot) and two of them are on line 17 (which I can see).

Without seeing everything, I expect the error is that compiler doesn’t know what FFileHelper and FPaths are, because you’ve not told it where to find the information for these structs.

You can tell the compiler where to look for this information using the #include statements at the top of your cpp file.

To find out what to put in here you should look at the UE4 API docs:

At the bottom of this page you see a references section, which will tell you the file location which in this case is listed as ‘Runtime/Core/Public/Misc/FileHelper.h’ and ‘Runtime/Core/Public/Misc/Paths.h’ Cut these down to the Public or Module name.

So, the top of your CPP file should look something like:

#include <some pre existing includes>
#include "Misc/FileHelper.h" //for FFileHelper
#include "Misc/Paths.h" //for FFilePaths

//rest of your code after this point

Note that You might need to do a bit more of this depending on what the errors are on line 12 which I can’t see.

Thank you :slight_smile:
And for this highlighted errors ??

I’m not actually sure. I don’t ever recall seeing this but given that one of the errors refers to permissions, maybe you need to running VS with administrator privileges.

It could also be an issue with missing dependencies or something in your Build.cs file but it’s hard to say without more information. Is this the only class you’ve added to the game? Are you able to paste the contents of both the .h and .cpp file as that might provide some hints.

Visual Studio likes to put up some strange errors and warnings for UE4. UE4 C++ is a bit different compared to normal C++ and VS doesn’t always understand it.

I personally don’t use the Error List tab, it almost always contains some bizarre error that isn’t actually an error, instead use the Output tab. It works very similar to the Error List, but the errors and warnings shown there are actual errors from the UE4 compiler. It’s quite possible that you can build the project (hit F7) and none of those Error List warnings/errors will show up in the list.

In the Output window you can still double click on a line of text in the log for error/warning and VS will jump to that line of code in your project, so it’s just as easy to use.

Try building to see if those are real errors or just VS nonsense, if there are any errors post an image of that log too.

You should not use direct paths to header files as it may create issues in future if you see something like this:

Runtime/Core/Public/Misc/FileHelper.h

you should cut begining of path to the “Public” directory or module directory if there no Public (module name in this case is “Core”) so it should be like this:

Misc/FileHelper.h

Yes, you’re absolutely right! I’ll edit my answer above.

OUTPUT

1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.Cpp.props(31,3): warning MSB4011: “C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.Makefile.props” cannot be imported again. It was already imported at “C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.cpp.props (31,3)”. This is most likely a build authoring error. This subsequent import will be ignored. [C:\Users\Jakub\Documents\Unreal Projects\Thesis2\Intermediate\ProjectFiles\Thesis2.vcxproj]
1>Cleaning Thesis2Editor Binaries…
1>Compiling game modules for hot reload
1>Compiling game modules for hot reload
1>Performing full C++ include scan (no include cache file)
1>Parsing headers for Thesis2Editor
1> Running UnrealHeaderTool “C:\Users\Jakub\Documents\Unreal Projects\Thesis2\Thesis2.uproject” “C:\Users\Jakub\Documents\Unreal Projects\Thesis2\Intermediate\Build\Win64\Thesis2Editor\Development\Thesis2Editor.uhtmanifest” -LogCmds=“loginit warning, logexit warning, logdatabase error” -Unattended -WarningsAsErrors -installed
1>C:/Users/Jakub/Documents/Unreal Projects/Thesis2/Source/Thesis2/RWInput.h(24) : LogCompile: Error: Type ‘double’ is not supported by blueprint. HandleLoadedTxt.ReturnValue
1>EXEC : error : UnrealHeaderTool failed for target ‘Thesis2Editor’ (platform: Win64, module info: C:\Users\Jakub\Documents\Unreal Projects\Thesis2\Intermediate\Build\Win64\Thesis2Editor\Development\Thesis2Editor.uhtmanifest, exit code: OtherCompilationError (5)).
1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.MakeFile.Targets(46,5): error MSB3073: The command ““C:\Program Files\Epic Games\UE_4.17\Engine\Build\BatchFiles\Rebuild.bat” Thesis2Editor Win64 Development “C:\Users\Jakub\Documents\Unreal Projects\Thesis2\Thesis2.uproject” -waitmutex” exited with code -1.
1>Done building project “Thesis2.vcxproj” – FAILED.
Rebuild All: 0 succeeded, 1 failed, 0 skipped

This looks like it could be the problem (or at least one of them)

LogCompile: Error: Type ‘double’ is not supported by blueprint

So, that means any UFUNCTION should not return a double, or take it as a parameter, and no UPROPERTY should be a double. Change them to floats instead and see if that works.

Thank you it is working :slight_smile: thanks a lot. :slight_smile:

Problem is Solved

Great! Could you mark this answer as accepted to help others find the solution.