so i am getting alot of 2019 lnk errors.errors
I am new to c++ and following a ebook i found. (game programming in c++ sanjay madhav)
I have started today but now im kinda stuck by all the linker errors. they seem to be all kinda the same and i cant seem to find where they came from. i have added the dls and all correctly i think. i am running it in x86 cause it is what the book uses.
the problem is i cant seem to find how to get rid of them.
my project is made with sdl in a c++ language using visual studio.
here is my code:
Game.h
#pragma once
#include <SDL.h>
class Game {
public:
Game();
bool Initialize();
void RunLoop();
void Shutdown();
private:
void ProcessInput();
void UpdateGame();
void GenerateOutput();
SDL_Window* Window;
bool IsRunning;
};
Game.cpp
#include "Game.h"
bool Game::Initialize() {
int sdlResult = SDL_Init(SDL_INIT_VIDEO);
if (sdlResult != 0)
{
SDL_Log("Unable to initialize SDL: %s", SDL_GetError());
return false;
}
Window = SDL_CreateWindow(
"Game Programming in c++ (Chapter 1)",
100,
100,
1280,
720,
0
);
if (!Window) {
SDL_Log("Failed to create window: %s", SDL_GetError());
return false;
}
return true;
}
void Game::RunLoop() {
while (IsRunning) {
ProcessInput();
UpdateGame();
GenerateOutput();
}
}
void Game::ProcessInput() {
SDL_Event event;
while (SDL_PollEvent(&event)) {
switch (event.type) {
case SDL_QUIT:
IsRunning = false;
break;
}
}
const Uint8* state = SDL_GetKeyboardState(NULL);
}
void Game::Shutdown() {
SDL_DestroyWindow(Window);
SDL_Quit();
}
and Main.cpp
#include "Game.h"
#undef main
int main(int argc, char** argv) {
Game game;
bool succes = game.Initialize();
if (succes) {
game.RunLoop();
}
game.Shutdown();
return 0;
}