   Linking problem, redefinition
  I'm playing around with completely overhauling my code for a more object oriented / expandable approach and I'm having a linking problem that I'm too dumb to figure out. I don't get it why it's already defined, what am I missing?1>gdi.obj : error LNK2005: "public: __thiscall bnr::video::Color::Color(void)" (??0Color@video@bnr@@QAE@XZ) already defined in renderer.obj1>gdi.obj : error LNK2005: "public: __thiscall bnr::video::Color::Color(unsigned int)" (??0Color@video@bnr@@QAE@I@Z) already defined in renderer.obj1>gdi.obj : error LNK2005: "public: __thiscall bnr::video::Color::Color(unsigned char,unsigned char,unsigned char,unsigned char)" (??0Color@video@bnr@@QAE@EEEE@Z) already defined in renderer.objcolor.h#pragma once#include "types.h"namespace bnr{namespace video{//////////////////////////////////////////////////////////////////////////struct Color{Color();Color(u32 c);Color(u8 a, u8 r, u8 g, u8 b);union{struct{u8 r;u8 g;u8 b;u8 a;};u8c8[4];u32 c32;};};//////////////////////////////////////////////////////////////////////////Color::Color(){c32 = 0x00000000;}Color::Color(u32 c){c32 = c;}Color::Color(u8 a, u8 r, u8 g, u8 b){c8[0] = r;c8[1] = g;c8[2] = b;c8[3] = a;}//hmm... byte ordering//////////////////////////////////////////////////////////////////////////}}renderer.h#pragma once#include "color.h"#include "matrix.h"namespace bnr{namespace video{//////////////////////////////////////////////////////////////////////////enum TRANSFORMTYPE{BNR_WORLD= 0,BNR_VIEW= 1,BNR_PROJECTION  = 2};class Renderer{public:virtual ~Renderer(){ };virtual void init(s32 x, s32 y)= 0;virtual void destroy()= 0;virtual void draw()= 0;virtual void drawPixel(s32 x, s32 y, const Color& col)= 0;virtual void drawLine(s32 x1, s32 y1, s32 x2, s32 y2, const Color& col)= 0;void setTransform(TRANSFORMTYPE flag, const math::Matrix& m);protected:s32width;s32height;math::Matrix world;math::Matrix view;math::Matrix projection;};//////////////////////////////////////////////////////////////////////////}}gdi.h#pragma once#include <Windows.h>#include "renderer.h"namespace bnr{namespace video{//////////////////////////////////////////////////////////////////////////class Gdi: public Renderer{public:Gdi();Gdi(s32 w, s32 h);~Gdi();void init(s32 x, s32 y);void destroy();void draw();void drawPixel(s32 x, s32 y, const Color& col);void drawLine(s32 x1, s32 y1, s32 x2, s32 y2, const Color& col);private:HWNDhwnd;HDChdc,hdcMem;HBITMAPdib,hbmOld;BITMAPINFObi;void*bits;//pointer to "framebuffer"};//////////////////////////////////////////////////////////////////////////}}gdi.cpp#include "gdi.h"namespace bnr{namespace video{//////////////////////////////////////////////////////////////////////////Gdi::Gdi(){init(320, 180);}Gdi::Gdi(s32 w, s32 h){init(w, h);}Gdi::~Gdi(){destroy();}void Gdi::init(s32 w, s32 h){width= w;height= h;memset(&bi, 0, sizeof(BITMAPINFO));bi.bmiHeader.biSize= sizeof(BITMAPINFO);bi.bmiHeader.biWidth    = width;bi.bmiHeader.biHeight   = -height;//top down dibbi.bmiHeader.biPlanes   = 1;bi.bmiHeader.biBitCount = 32;hdc= GetDC(GetForegroundWindow());hdcMem= CreateCompatibleDC(hdc);dib= CreateDIBSection(hdc, &bi, DIB_RGB_COLORS, &bits, NULL, 0);hbmOld= (HBITMAP)SelectObject(hdcMem, dib);}void Gdi::destroy(){SelectObject(hdcMem, hbmOld);DeleteObject(dib);ReleaseDC(hwnd, hdc);DeleteDC(hdcMem);}void Gdi::draw(void){BitBlt(hdc, 0, 0, width, height, hdcMem, 0, 0, SRCCOPY);memset(bits, 0, (width * height) * 4);}void Gdi::drawPixel(s32 x, s32 y, const Color& col){if((x | y) >= 0 && x < width  && y < height) //check bounds{u32* dst = (u32*)bits + (y * width + x);if(col.a == 0x00){*dst = 0x00000000;return;}if(col.a == 0xFF){*dst = col.c32;return;}else{DWORD dst_ag = *dst& 0xFF00FF00;DWORD dst_rb = *dst& 0x00FF00FF;DWORD src_ag = col.c32& 0xFF00FF00;DWORD src_rb = col.c32& 0x00FF00FF;dst_ag = src_ag - dst_ag;dst_rb = src_rb - dst_rb;dst_ag *= col.a;dst_rb *= col.a;  dst_ag >>= 8;dst_rb >>= 8;dst_ag = dst_ag & 0xFF00FF00;dst_rb = dst_rb & 0x00FF00FF;*dst = ((dst_ag | dst_rb) + *dst);}}}void Gdi::drawLine(s32 x1, s32 y1, s32 x2, s32 y2, const Color& col){return;//not implemented}//////////////////////////////////////////////////////////////////////////}}
  If you put a function definition in a header, it needs to be inlined. This can be either explicitly with the inline keyword or implicitly by (for example) placing the function definition inside the class definition.   ;  Ahhh, that was it. I don't know why I had it like that in the first place.It's the dopiest things that waste the most time.   