Here is the code:
Engine.h
#ifndef _ENGINE_H
#define _ENGINE_H
#include <SFML\Graphics.hpp>
class Engine
{
private:
sf::RenderWindow* window;
bool Init();
void MainLoop();
void RenderFrame();
void ProcessInput();
void Update();
public:
Engine();
~Engine();
void Go(); };
#endif
Engine.cpp
include "Engine.h"
#include <SFML\Graphics.hpp>
Engine::Engine()
{
}
Engine::~Engine()
{
}
bool Engine::Init()
{
window = new sf::RenderWindow(sf::VideoMode(800, 600, 32), "RPG");
if(!window)
return false;
return true;
}
void Engine::RenderFrame()
{
}
void Engine::ProcessInput()
{
sf::Event evt;
while(window->pollEvent(evt))
{
if(evt.type == sf::Event::Closed)
window->close();
}
}
void Engine::Update()
{
}
void Engine::MainLoop()
{
while(window->isOpen())
{
ProcessInput();
Update();
RenderFrame();
}
}
void Engine::Go()
{
if(!Init())
throw "Could not initialize Engine";
MainLoop();
}
and Main.cpp
#include <Windows.h>
#include "Engine.h"
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PWSTR pCmdLine, int nCmdShow)
{
Engine* engine = new Engine();
try
{
engine->Go();
}
catch(char* e)
{
MessageBoxA(NULL, e, "Exception Occured", MB_OK | MB_IConerror);
}
}
Errors:
||=== Build: Debug in Game Engine (compiler: GNU GCC Compiler) ===|
obj\Debug\Engine.o||In function `ZN6Engine4InitEv':|
C:\Users\dento\Desktop\Game Engine\Engine.cpp|17|undefined reference to `_imp___ZN2sf9VideoModeC1Ejjj'|
C:\Users\dento\Desktop\Game Engine\Engine.cpp|17|undefined reference to `_imp___ZN2sf6StringC1EPKcRKSt6locale'|
C:\Users\dento\Desktop\Game Engine\Engine.cpp|17|undefined reference to `_imp___ZN2sf12RenderWindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE'|
obj\Debug\Engine.o||In function `ZN6Engine12ProcessInputEv':|
C:\Users\dento\Desktop\Game Engine\Engine.cpp|31|undefined reference to `_imp___ZN2sf6Window9pollEventERNS_5EventE'|
C:\Users\dento\Desktop\Game Engine\Engine.cpp|37|undefined reference to `_imp___ZN2sf6Window5closeEv'|
obj\Debug\Engine.o||In function `ZN6Engine8MainLoopEv':|
C:\Users\dento\Desktop\Game Engine\Engine.cpp|47|undefined reference to `_imp___ZNK2sf6Window6isOpenEv'|
C:\Users\dento\Desktop\Game Engine\Engine.cpp|47|undefined reference to `_imp___ZN2sf6Window9pollEventERNS_5EventE'|
obj\Debug\Engine.o||In function `ZN6Engine12ProcessInputEv':|
C:\Users\dento\Desktop\Game Engine\Engine.cpp|37|undefined reference to `_imp___ZN2sf6Window5closeEv'|
obj\Debug\Engine.o||In function `ZN6Engine2GoEv':|
C:\Users\dento\Desktop\Game Engine\Engine.cpp|59|undefined reference to `_imp___ZNK2sf6Window6isOpenEv'|
C:\Users\dento\Desktop\Game Engine\Engine.cpp|59|undefined reference to `_imp___ZN2sf6Window9pollEventERNS_5EventE'|
obj\Debug\Engine.o||In function `ZN6Engine12ProcessInputEv':|
C:\Users\dento\Desktop\Game Engine\Engine.cpp|37|undefined reference to `_imp___ZN2sf6Window5closeEv'|
c:\mingw\bin\..\lib\gcc\mingw32\4.9.3\..\..\..\libmingw32.a(main.o):(.text.startup+0xa0)||undefined reference to `WinMain@16'|
||error: ld returned 1 exit status|
||=== Build failed: 13 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
just noticed in the errors that some of them are in the .o file. How would I fix this?
What I have tried:
I have tried changing the names, I have tried to find what it is saying I didn't reference, other than that I don't know what to try.