Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Undefined reference to `__ms_vsnprintf' when linking GLFW statically

I am trying to compile the GLFW quickstart guide (Here) in windows 8 64-bit using mingw. I am using the official 32 bit windows binary from the glfw website.

Everything works fine when I link the glfw library dynamically by linking -lglfw3dll -lgdi32 -lopengl32 -lglew32 and defining GLFW_DLL.

When I try to link glfw statically, however, I get undefined reference to '__ms_vsnprintf'

My command to link statically is mingw32-g++.exe -o bin\Release\test.exe obj\Release\main.o -s -lglfw3 -lgdi32 -lopengl32 -lglew32s with GLEW_STATIC defined.

like image 816
NoviceCodingGeek Avatar asked May 07 '26 20:05

NoviceCodingGeek


1 Answers

I got the same problem when I tried to build an example app for GLFW. I switched the compiler suite from original MinGW32 to MinGW-W64 and that solved the problem. I came up with that idea after reading this post:

https://sourceforge.net/p/mingw/mailman/mingw-users/thread/83ha2x1i7k.fsf%40gnu.org/

Seems the GLFW libs are build with a MinGW64 or MinGW-W64.

like image 58
shinzo Avatar answered May 10 '26 09:05

shinzo



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!