Undefined reference in MinGW after moving from VC++

48 Views Asked by At

I'm trying to compile my OpenGL shared library using g++ in MinGW but I get an error with undefined function reference.

I link all the necessary static libraries, but it doesn't work. Previously it was compiled via VC++, but after moving to MinGW it broke.

Could this be some kind of MinGW feature?

Error

Warning: resolving _GetModuleHandleA@4 by linking to _GetModuleHandleA
...
...
c:/mingw/bin/../lib/gcc/mingw32/6.3.0/crtbegin.o:cygming-crtbegin.c:(.text+0x29): undefined reference to `LoadLibraryA@4'

Compilation settings

g++ 
-g -Wall -shared
-IC:/Users/nikita/.jdks/corretto-11.0.22/include -IC:/Users/nikita/.jdks/corretto-11.0.22/include/win32
-LC:/Windows/System32
-lopengl32 -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32
-o artifact 
src/shared.h src/gl/shared-gl.h src/gl/windows.cpp
0

There are 0 best solutions below