Hello,
I’m very new to C++ so I tried to do tutorials like the Powerup videos on youtube by Unreal Engine, and the LightSwitchCodeOnly tutorial, but encountered lots of errors, and also I have some other questions as well.
So first, in the LightSwitchCodeOnly source file, there is #include “BasicClasses.h”, but there are two error I got so far, 1 "IntelliSense cannot open source file “BasicClasses.h”, and 2 " error c1083: Cannot open include file: “BasicClasses.h”: No such file or directory. So why do I get this error and how can I fix it?
Second: “failed to produce item: C:\ … \ProjectName\Binaries\Win64\UE4Editor-ProjectName-Win64-DebugGame.dll”.
Third: “MB3073: The command ““E:\Unreal Engine\Epic Games\4.9\Engine\Build\BatchFiles\Build.bat” ProjectNameEditor Win64 DebugGame “C:…\Unreal Projects\ProjectName\ProjectName.uproject” -rocket -waitmutex” exited with code -1.”
Other questions are:
1- Why does a float have ‘f’ in its value, for example “DesiredIntensity = 3000.0f”? (Again, I’m new to c++ so maybe that’s why I don’t know, but I don’t remember using ‘f’ in a float’s value from when I was doing c++ tutorials)
2- When I create a new actor class in VS (with no code) and add that to my scene in UE4, it doesn’t show the transform gizmo for it. Is it because I have to add a scene component for it (like in blueprint) or is it something else?
Any answer to any of my questions is appreciated, but please keep in mind that I’m new so I may not understand a pure technical explanation, so instead, in the case of “BasicClasses.h” problem for example, please just tell me something like “download this, copy paste there…” etc, so keep it simple and straightforward.
To start off with, the LightSwitchCodeOnly section that you’re referring to isn’t a literal tutorial as BatteryCollector / Powerup is, meaning it isn’t as detailed. In the case of the BasicClasses.h file, this is only speculation as I haven’t seen the original code this came from, but I believe BasicClasses is the name of the project that this class was contained in. If you replace that with MyProject (Or whatever your project name is) it should compile without issue.
I actually just saw a few other errors with a snipet of code in that documentation as well. I’ll work on getting it fixed. The issue I found is that the lines where AddDynamic is called for the two overlap functions are missing the full name of the functions, as they are only saying “OnOverlap” instead of “OnOverlapEnd” and “OnOverlapBegin”. Be sure to make this change.
As for the second and third error messages. While they are long and seem like they mean something, they are actually just saying, in their own way, that the compile failed. Whenever you see those messages, you can always refer to the above error (your first one) for more information. As a side note, whenever the error messages don’t give you enough information to debug the error, be sure to use the Output log as it is much more literal than the error list.
For your first question about floats, the .f is used in C++ to tell the compiler to not truncate the value, as it would normally drop the floating point and make it into an integer value.
For your second question, you’re correct. This is because you don’t have anything in the class yet that has a transform component and also nothing set as your root component. Adding/initializing a USceneComponent or any other component with a transform (such as UStaticMeshComponent) will fix this.