Why am I getting an undedined reference to this function?
I have three files: window.h: #include <SDL2/SDL.h> #include <SDL2/glew.h> class Window { public: Window() {} ~Window() {} void run(); void initSDL(); private: SDL_Window* _window; int _width = 1024; int _height = 678; }; window.cpp: #include "window.h" int main() { void Window::Window() { Â _window = nullptr; } void Window::~Window() { } void Window::run() { Â initSDL(); } void Window::initSDL() { Â SDL_Init(SDL_INIT_EVERYTHING); Â _window = SDL_CreateWindow("Neptune's Limit", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, _width, _height, SDL_WINDOW_OPENGL); } } main.cpp: #include <iostream> #include "window.h" #include "window.cpp" int main(int argc, char* argv[]) { Â Â Window window; Â Â window.run(); Â Â std::cout << "Enter any character to continue" << std::endl; Â Â char a; Â Â std::cin >> a; Â Â return 0; } When I run it, nevermind all the confusing SDL functions, I get an undefined reference to Window::run(). Why?