** Edit, here's the pictures of my linking stuff... : **
https://i.stack.imgur.com/w8F3z.jpg
So, I keep getting the "unresolved Externals" error which I can't fix. I've read lots of different posts about this on different sites none of them have helped at all. Still have no idea what to do.
Someone told me something about defining and declaring variables, however I didn't understand what he meant...
Would be great if someone could tell me what to modify in my code instead. :)
Error list :
Error 5 error LNK1120: 3 unresolved externals C:\Users\MyName\Desktop\SDL_Game\Debug\SDL_Game.exe 1 1 SDL_Game
Error 3 error LNK2001: unresolved external symbol "public: static bool CoreEngine::isRunning" (?isRunning@CoreEngine@@2_NA) C:\Users\MyName\Desktop\SDL_Game\SDL_Game\CoreEngine.obj SDL_Game
Error 2 error LNK2019: unresolved external symbol "public: class Window __thiscall CoreEngine::window(void)" (?window@CoreEngine@@QAE?AVWindow@@XZ) referenced in function "public: __thiscall CoreEngine::CoreEngine(void)" (??0CoreEngine@@QAE@XZ) C:\Users\MyName\Desktop\SDL_Game\SDL_Game\CoreEngine.obj SDL_Game
Error 4 error LNK2019: unresolved external symbol _SDL_main referenced in function _main C:\Users\MyName\Desktop\SDL_Game\SDL_Game\SDL2main.lib(SDL_windows_main.obj) SDL_Game
All Project Files :
CoreEngine.h
#pragma once
#include <SDL.h>
#include "Window.h"
class CoreEngine
{
public:
Window window();
CoreEngine();
~CoreEngine();
static bool isRunning;
private:
};
CoreEngine.cpp
#include "CoreEngine.h"
#include <iostream>
CoreEngine::CoreEngine()
{
CoreEngine::isRunning = false;
CoreEngine::window;
if (SDL_Init(SDL_INIT_EVERYTHING) < 0)
{
CoreEngine::isRunning = false;
std::cout << "Failed To Initialize SDL" << std::endl;
system("PAUSE");
SDL_Quit();
}
else
{
while (CoreEngine::isRunning)
{
}
}
}
CoreEngine::~CoreEngine()
{
}
Window.h
#pragma once
#include <SDL.h>
class Window
{
public:
Window();
~Window();
SDL_Window* window;
private:
int CreateWindow();
};
Window.cpp
#include "Window.h"
Window::Window()
{
CreateWindow();
}
Window::~Window()
{
}
int Window::CreateWindow()
{
window = SDL_CreateWindow("Engine Title", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS);
if (window == NULL)
{
return -1;
}
else
{
return 0;
}
}