1
General / SFML Game Development
« on: January 23, 2015, 06:32:10 am »
I am beginner in game development and trying to make a game called space craft but i have some problems and i can't define what they are so i have attached the error message with my code.If anybody can help it's appreciated.
Main.cpp
Header.h
Definitions.cpp
Main.cpp
#include<iostream>
#include"Header.h"
using namespace std;
int main(){
Game game;
game.Run();
system("pause");
return 0;
}
#include"Header.h"
using namespace std;
int main(){
Game game;
game.Run();
system("pause");
return 0;
}
Header.h
#include<SFML/Graphics.hpp>
using namespace sf;
class Game{
public:
Game();
void Run();
private:
const Time TimePerFrame = seconds(1.f / 60.f);
Time TimeSinceLastUpdate;
bool IsMovingUp, IsMovingRight, IsMovingLeft, IsMovingDown;
void HandlePlayerInput(Keyboard::Key key, bool IsPressed);
private:
RenderWindow window;
Texture Ptexture;
Sprite Player;
private:
void ProcessEvents();
void Update(const Time TimePerFrame);
void Render();
};
using namespace sf;
class Game{
public:
Game();
void Run();
private:
const Time TimePerFrame = seconds(1.f / 60.f);
Time TimeSinceLastUpdate;
bool IsMovingUp, IsMovingRight, IsMovingLeft, IsMovingDown;
void HandlePlayerInput(Keyboard::Key key, bool IsPressed);
private:
RenderWindow window;
Texture Ptexture;
Sprite Player;
private:
void ProcessEvents();
void Update(const Time TimePerFrame);
void Render();
};
Definitions.cpp
#include<iostream>
#include<SFML/Graphics.hpp>
#include<SFML/System.hpp>
#include<SFML/Window/ContextSettings.hpp>
#include"Header.h"
using namespace std;
Game::Game(){
TimeSinceLastUpdate = Time::Zero;
window.create(sf::VideoMode(640, 480), "Game Application", Style::Default);
if (!Ptexture.loadFromFile("plane.png")){
cout << "Error !\n";
return;
}
Player.setTexture(Ptexture);
// Scalling the craft
Player.setScale(0.5, 0.5);
Player.setPosition(100.f, 100.f);
IsMovingDown = IsMovingLeft = IsMovingRight = IsMovingUp = 0;
}
and this is the error messsage#include<SFML/Graphics.hpp>
#include<SFML/System.hpp>
#include<SFML/Window/ContextSettings.hpp>
#include"Header.h"
using namespace std;
Game::Game(){
TimeSinceLastUpdate = Time::Zero;
window.create(sf::VideoMode(640, 480), "Game Application", Style::Default);
if (!Ptexture.loadFromFile("plane.png")){
cout << "Error !\n";
return;
}
Player.setTexture(Ptexture);
// Scalling the craft
Player.setScale(0.5, 0.5);
Player.setPosition(100.f, 100.f);
IsMovingDown = IsMovingLeft = IsMovingRight = IsMovingUp = 0;
}
Error 4 error LNK1120: 3 unresolved externals c:\users\programmer\documents\visual studio 2013\Projects\GameDevelopment\Debug\GameDevelopment.exe
Error 1 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z) referenced in function "public: __thiscall Game::Game(void)" (??0Game@@QAE@XZ) c:\Users\programmer\documents\visual studio 2013\Projects\GameDevelopment\GameDevelopment\Definitions.obj
Error 2 error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::create(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (__imp_?create@Window@sf@@QAEXVVideoMode@2@ABVString@2@IABUContextSettings@2@@Z) referenced in function "public: __thiscall Game::Game(void)" (??0Game@@QAE@XZ) c:\Users\programmer\documents\visual studio 2013\Projects\GameDevelopment\GameDevelopment\Definitions.obj
Error 3 error LNK2019: unresolved external symbol "public: void __thiscall Game::Run(void)" (?Run@Game@@QAEXXZ) referenced in function _main c:\Users\programmer\documents\visual studio 2013\Projects\GameDevelopment\GameDevelopment\Main.obj
5 IntelliSense: no instance of constructor "sf::ContextSettings::ContextSettings" matches the argument list c:\Users\Programmer\Documents\Visual Studio 2013\Projects\GameDevelopment\include\SFML\Window\Window.hpp 89
6 IntelliSense: no instance of constructor "sf::ContextSettings::ContextSettings" matches the argument list c:\Users\Programmer\Documents\Visual Studio 2013\Projects\GameDevelopment\include\SFML\Window\Window.hpp 106
7 IntelliSense: no instance of constructor "sf::ContextSettings::ContextSettings" matches the argument list c:\Users\Programmer\Documents\Visual Studio 2013\Projects\GameDevelopment\include\SFML\Window\Window.hpp 133
8 IntelliSense: no instance of constructor "sf::ContextSettings::ContextSettings" matches the argument list c:\Users\Programmer\Documents\Visual Studio 2013\Projects\GameDevelopment\include\SFML\Window\Window.hpp 151
9 IntelliSense: no instance of constructor "sf::ContextSettings::ContextSettings" matches the argument list c:\Users\Programmer\Documents\Visual Studio 2013\Projects\GameDevelopment\include\SFML\Graphics\RenderWindow.hpp 76
10 IntelliSense: no instance of constructor "sf::ContextSettings::ContextSettings" matches the argument list c:\Users\Programmer\Documents\Visual Studio 2013\Projects\GameDevelopment\include\SFML\Graphics\RenderWindow.hpp 94
Error 1 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall sf::VideoMode::VideoMode(unsigned int,unsigned int,unsigned int)" (__imp_??0VideoMode@sf@@QAE@III@Z) referenced in function "public: __thiscall Game::Game(void)" (??0Game@@QAE@XZ) c:\Users\programmer\documents\visual studio 2013\Projects\GameDevelopment\GameDevelopment\Definitions.obj
Error 2 error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall sf::Window::create(class sf::VideoMode,class sf::String const &,unsigned int,struct sf::ContextSettings const &)" (__imp_?create@Window@sf@@QAEXVVideoMode@2@ABVString@2@IABUContextSettings@2@@Z) referenced in function "public: __thiscall Game::Game(void)" (??0Game@@QAE@XZ) c:\Users\programmer\documents\visual studio 2013\Projects\GameDevelopment\GameDevelopment\Definitions.obj
Error 3 error LNK2019: unresolved external symbol "public: void __thiscall Game::Run(void)" (?Run@Game@@QAEXXZ) referenced in function _main c:\Users\programmer\documents\visual studio 2013\Projects\GameDevelopment\GameDevelopment\Main.obj
5 IntelliSense: no instance of constructor "sf::ContextSettings::ContextSettings" matches the argument list c:\Users\Programmer\Documents\Visual Studio 2013\Projects\GameDevelopment\include\SFML\Window\Window.hpp 89
6 IntelliSense: no instance of constructor "sf::ContextSettings::ContextSettings" matches the argument list c:\Users\Programmer\Documents\Visual Studio 2013\Projects\GameDevelopment\include\SFML\Window\Window.hpp 106
7 IntelliSense: no instance of constructor "sf::ContextSettings::ContextSettings" matches the argument list c:\Users\Programmer\Documents\Visual Studio 2013\Projects\GameDevelopment\include\SFML\Window\Window.hpp 133
8 IntelliSense: no instance of constructor "sf::ContextSettings::ContextSettings" matches the argument list c:\Users\Programmer\Documents\Visual Studio 2013\Projects\GameDevelopment\include\SFML\Window\Window.hpp 151
9 IntelliSense: no instance of constructor "sf::ContextSettings::ContextSettings" matches the argument list c:\Users\Programmer\Documents\Visual Studio 2013\Projects\GameDevelopment\include\SFML\Graphics\RenderWindow.hpp 76
10 IntelliSense: no instance of constructor "sf::ContextSettings::ContextSettings" matches the argument list c:\Users\Programmer\Documents\Visual Studio 2013\Projects\GameDevelopment\include\SFML\Graphics\RenderWindow.hpp 94