Wrapper class for SDL2 help

ENV: Windows10, CodeBlocks, GNU G++

I’m trying to put a simple wrapper class around SDL to hide it from the user of my wrapper class (all they should need to include is myClass.h).

I keep getting error around the entry point i.e. undef ref to WinMain@16 (or undef ref to sdl_main) since myClass doesn’t have a main(), I think SDL is getting confused. Any ideas? I know adding -lSDL2main & -lSDL2 will solve the issue, but I don’t want to have to reference those libs when building a program using myClass.

Wrapper Class built as DLL with -lmingw32 -lSDL2main -lSDL2 linked dynamically with -I & -L having locations of SDL headers and all the SDL libs/DLL’s.:

// myClass.h
#include “SDL.h”

class myClass

// myClass.cpp
#include “myClass.h”


Test program to use myClass build console-app with -lmingw32 -lmyClass dynamically with -I & -L having locations of myClass.h, myClass.dll, and all the SDL DLL’s.
// test.cpp
#include “myClass.h”

int main(int argc, char **argv)
myClass var1;

return 0;


I should note myClass builds fine when output is a DLL, If I built myClass as a console-app, it fails with undef ref to sdl_main, since I have no main function in my class.

When I build myClass successfully as DLL, I get error in the test.cpp program related to undef ref to WinMain@16.

Was able to get it by adding #define SDL_MAIN_HANDLED before #include <SDL.h>