I started trying to develop a game engine. As a result, I cannot compile! Please tell me what should be fixed or added so that I can compile the DLL? I note that I'm a beginner in C++, and this is my first attempt to create a DLL library in C++.
So. The project has the following CPP files: dllmain.cpp (generate by VS), Engine.cpp, pch.cpp, World Game Engine.cpp. The project has header file Engine.h.
Code of Engine.h:
#pragma once
#include <SFML/Graphics.hpp>
using namespace sf;
class Engine
{
private:
RenderWindow m_Window;
void input();
void update(float dtAsSeconds);
void draw();
public:
Engine();
void start();
};
Code of Engine.cpp:
#include "stdafx.h"
#include "Engine.h"
#include "pch.h"
Engine::Engine()
{
Vector2f resolution;
resolution.x = VideoMode::getDesktopMode().width;
resolution.y = VideoMode::getDesktopMode().height;
m_Window.create(VideoMode(resolution.x, resolution.y),
"World Game Engine",
Style::Fullscreen);
}
void Engine::start()
{
Clock clock;
while (m_Window.isOpen())
{
Time dt = clock.restart();
float dtAsSeconds = dt.asSeconds();
input();
update(dtAsSeconds);
draw();
}
}
Code of World Game Engine.cpp:
#include "stdafx.h"
#include "Engine.h"
#include "pch.h"
int init()
{
Engine engine;
engine.start();
return 0;
}
So, I get a lot of errors.
I can’t create a screenshot because I have a Russian version of VS. But if necessary, I can switch to the English version and take a screenshot. SFML has been linked.