Ignoring your rather strange looking loop which doesn't make sense to me.
If a function has been declared as having a return value, then every possible routes to exit that function
must have a return statement.
Consider the example below:
If the if statement tests true then the if block is executed - we exit the function in this block
and we return a value - OK.
If the if tests fails then we skip past the if block to line 9 - as you can see we reach the end of the function - but we have not specified a return value
1 2 3 4 5 6 7 8 9 10 11 12 13
int someFunction()
{
if (/* insert test condition here*/)
{
//insert some code here
return /*insert return value here*/;
}
//maybe some more code here
//Problem - need to do a return value here
}
What must your function do? Do you realize that only one (the first one) return has an effect?
The warning appears because if SIZE==0 then no iteration is performed and there is no return to be encountered before reaching the closing '}' of the function body.
1. You have not put proper header guards in your header file(s).
OR
2. You have placed a global variable in a header file. This header file is being included in several cpp files
so you are getting multiple definition errors for the variable.