I am trying to open a window using some SDL2 coding. However, every time I try to compile and run the code, visual studio always gives me the same error(s).
Error: 'identifier' : function cannot be overloaded
Here is my code:
#include <iostream>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <SDL.h>
#include <SDL_opengl.h>
#include <SDL_image.h>
#include <Windows.h>
using namespace std;
const int WIDTH = 800, HEIGHT = 600;
int WinMain(int argc, char* argv[])
{
SDL_Init(SDL_INIT_EVERYTHING);
SDL_Window *window = SDL_CreateWindow("Hello SDL World", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, WIDTH, HEIGHT, SDL_WINDOW_ALLOW_HIGHDPI);
// Check that the window was successfully created
if (NULL == window)
{
// In the case that the window could not be made...
std::cout << "Could not create window: " << SDL_GetError() << std::endl;
return 1;
}
SDL_Event windowEvent;
while (true)
{
if (SDL_PollEvent(&windowEvent))
{
if (SDL_QUIT == windowEvent.type)
{
break;
}
}
}
SDL_DestroyWindow(window);
SDL_Quit();
return EXIT_SUCCESS;
}
Here is some warnings they gave me in case they matter:
Warning #1: 'WinMain': Must be '_stdcall'
Warning #2: 'APIENTRY': macro redefinition