Hello leander g,
First start with enough code that can be compiled and tested. And enough code that will duplicate the problem. What you have not shown could be where the problem starts.
Second it is always best to post the complete error message generated by the compiler. It is quite possible that your interpretation of the error message may not be correct.
When trying to duplicate your error I ended up with this code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
|
int ActualTime = 0; //Current time in seconds, starts at 0
int SimulationStartTimeSS{}, SimulationStartTimeMM{}, SimulationStartTimeHH{};
//The problematic function:
bool CheckTime(int SomeNumber)
{
bool ReturnValue{};
ActualTime = SimulationStartTimeSS + SimulationStartTimeMM * 60 + SimulationStartTimeHH * 60 * 60;
//do some other stuff ...
return ReturnValue;
}
int main()
{ }
|
Still this did not duplicate your problem, but I can not see what is missing.
In line 10 "ActualTime" was not a problem, but the other 3 variables gave the error as undefined. That is why I added line 2 for now.
As a note neither line 1 or line 2 should be defined as global variables because any line of code that follows them can change the value(s) and try to figure out where that happened could take a very long time, (hours or even days).
It would be better to put lines 1 and 2 in "main" and pass them to the function(s) that need them.
The last part I noticed is:
bool ReturnValue;
. You have defined the variable, but it contains a garbage value. Not sure if "//do some other stuff ..." would give this variable a proper value or not I had to initialize the variable so the return statement would not become an error.
If you can post the entire code or people can only guess at what might be wrong.
Andy