When I try to build my application the linker gives loads of errors like this one:
modlauch.obj : error LNK2005: “public:
virtual __thiscall
lolbutton::~lolbutton(void)”
(??1lolbutton@@UAE@XZ) already defined
in lolbutton.obj
I suspect it has something to do with misconfigured compiler but I don’t know how to fix it. My class is only included once so I don’t think it has anything to do with the code. I have tried rebuilding and cleaning the project but it didn’t help.
Can someone suggest a solution to this problem? My platform is Win32(C++) and I’m using MFC.
You’ll get the linker error when you wrote the class like this:
lolbutton.h:
You won’t get it when you write it like this:
Fix the linker error by moving the destructor definition from the .h file to a .cpp file. This ensures there is only one definition of the destructor.