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
{
public:
myClass();
};
// myClass.cpp
#include “myClass.h”
myClass::myClass()
{
SDL_Init( SDL_INIT_EVERYTHING );
SDL_Quit();
}
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;
}