hi, I am making a swimming sport system, but I have a problem.
the issue is that:
FString season = "summer";
gives me “FString is not valid” in output, so I tried
string season = "summer";
and that gave me “string: undeclared identifier”
error is on line: 7
script (numbers on left are not in actual script, only for you to read lines easier):
1. #include "season.h"
2.
3. //correct season function
4. void correct_season() {
5.
6. //season string
7. string season = "summer";
8.
9. //if season is spring or summer do
10. if (season = "summer") {
11.
12. }
13. }
14. correct_season();
I see #include "season.h", so it must be “season.cpp” file, right?
Are you trying to declare of a string outside a namespace? That’s not going to work. You can either declare it in .h inside UCLASS(), or within a function in .cpp. You can’t declare it in an empty space in .cpp.
I just change string to be FString in .h file, and it worked!!! (as in i don’t see any .h errors, I only see .cpp file errors) But I still have the “unidentified error” this post was about in the first place.