I'm making a small game engine and have a project in Code::Blocks for it, and a project to test it out. The thing is that my test program won't find a constructor from the engine. Here's my code:
#ifndef SCREEN_HPP_INCLUDED
#define SCREEN_HPP_INCLUDED
#include "SDL.h"
namespace myeng
{
class Screen final //This class doesn't need to be derived from
{
public:
//Constructor and destructor
Screen(int height, int width);
~Screen();
//Functions to get the width, height, and depth of the screen
int getScreen_Width();
int getScreen_Height();
int getScreen_Depth();
private:
//Constants
constint SCREEN_WIDTH = 0;
constint SCREEN_HEIGHT = 0;
constint SCREEN_DEPTH = 0;
//Surfaces
SDL_Surface* screen_ptr = nullptr; //Creates the main surface for the screen
};
}
#endif // SCREEN_HPP_INCLUDED
You need to compile the engine (either by adding the source files to the test project or separately compiling it into an object file and linking to that in the test project). If you only include the header files in the test project, the compiler will only see the function declarations but not the definitions.