I am using Lazy Foo's Production tutorials for making an SDL game in C in Xcode 6.1 - http://lazyfoo.net/tutorials/SDL/index.php#Hello%20SDL. I'm using Xcode 7 but I don't think they are very different.
In the second tutorial (http://lazyfoo.net/tutorials/SDL/02_getting_an_image_on_the_screen/index.php). I cannot seem to compile properly without an error regarding one of the functions.
The function prototype:
//Frees media and shuts down SDL
void close();
Then the function declaration:
void close()
{
//Deallocate surface
SDL_FreeSurface( gHelloWorld );
gHelloWorld = NULL;
//Destroy window
SDL_DestroyWindow( gWindow );
gWindow = NULL;
//Quit SDL subsystems
SDL_Quit();
}
And then the function call at the end:
close();
I am getting these errors and am not quite sure how to fix them. Other solutions online are for problems that are not quite the same as mine.
SDL_Tutorial/SDL_Tutorial/using_image.c:28:6: Conflicting types for 'close'
SDL_Tutorial/SDL_Tutorial/using_image.c:28:6: Conflicting types for 'close'
SDL_Tutorial/SDL_Tutorial/using_image.c:127:5: Implicit declaration of function 'close' is invalid in C99
SDL_Tutorial/SDL_Tutorial/using_image.c:127:11: Too few arguments to function call, expected 1, have 0
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any help would be much appreciated, as I am struggling to make progress with learning SDL game programming at the moment.
Thank you.
close()
function has overloaded version with different amount is parameters? Is it declared in the same file from which is get called? \$\endgroup\$