Source Code

makefile

OBJS = main.o player.o enemy.o
CXX = g++
CXXFLAGS = -Wall -std=c++11
LDLIBS = -lsfml-graphics -lsfml-audio -lsfml-window -lsfml-system

# LDFLAGS = "-L/c/SFML-2.5.1/lib"
# CPPFLAGS = "-I/c/SFML-2.5.1/include"

game: $(OBJS)
    $(CXX) -o game $(OBJS) $(LDLIBS) $(LDFLAGS)

main.o: player.h
player.o: player.h
enemy.o: enemy.h

clean:
    $(RM) game $(OBJS)

# player.o: player.cpp player.h
#   g++ -c player.cpp

# target: dependencies
#   command(s)

main.cpp

#include <iostream>
#include "player.h"
#include <SFML/Graphics.hpp>

int main()
{
    Player player;
    std::cout << "Healthx: "
          << player.m_health << '\n';

    sf::RenderWindow window(sf::VideoMode(800, 600), "Title");

    sf::Event event;

    while (window.isOpen())
    {
        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
            {
                window.close();
            }
        }
    }

    return 0;
}

player.h

class Player
{
public: 
    Player();
    int m_health;
};

player.cpp

#include "player.h"

Player::Player()
{
    m_health = 100;
}

enemy.h

class Enemy
{
public: 
    Enemy();
    int m_health;
};

enemy.cpp

#include "enemy.h"

Enemy::Enemy()
{
    m_health = 10000;
}