Error LNK1561 Entry point must be defined.

  • Thread starter Thread starter m0cvo
  • Start date Start date
M

m0cvo

Guest
Hi

I am attempting to write a game using C++ and SDL2. I have created an header file - Game.h - and an associated class - Game.cpp.

#pragma once
#include "C:\Users\Nigel\Documents\Visual Studio 2017\SDL2-2.0.8\include\SDL.h"
class Game
{
public:
Game();
// Initialize the game
bool Initialize();
// Run game loop until the end of the game
void RunLoop();
// Shut down the game
void Shutdown();

private:
// Helper functions for the game loop
void ProcessInput();
void UpdateGame();
void GenerateOutput();

// Window created by SDL
SDL_Window* mWindow;
// Game should continue to run
bool mIsRunning;
~Game();
};

The header is above, the class is defined at the top and is as follows:

#include "Game.h"



Game::Game()
{

}

bool Game::Initialize()
{
int sdlResult = SDL_Init(SDL_INIT_VIDEO);

if (sdlResult != 0)
{
SDL_Log("Unable to initialize SDL: %s", SDL_GetError());
return false;
}

mWindow = SDL_CreateWindow(
"Game screen", // Window title
100, // Top left x coordinate
100, // Top left y coordinate
1024, // Width of window
768, // Height of window
0 // Flags (0 for no flags set)
);

if (!mWindow)
{
SDL_Log("Failed to create window: %s", SDL_GetError());
return false;
}
}

void Game::Shutdown()
{
SDL_DestroyWindow(mWindow);
SDL_Quit();
}

void Game::RunLoop()
{
while (mIsRunning)
{
ProcessInput();
UpdateGame();
GenerateOutput();
}
}




Game::~Game()
{
}


This should produce a blank screen with but build fails with Error LNK1561 Entry Point Must be defined.

I am new to C++ but have used C# to some extent.

Any pointers here?




Nigel..

Continue reading...
 
Back
Top