Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
698 views
in Technique[技术] by (71.8m points)

c++ - 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 binReleaseest.exe objReleasemain.o -s -lglfw3 -lgdi32 -lopengl32 -lglew32s with GLEW_STATIC defined.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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:

http://mingw-users.1079350.n2.nabble.com/missing-symbol-ms-vsnprintf-when-linking-with-cross-compiled-library-td7582798.html

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...