静态链接GLFW时未定义对__ms_vsnprintf的引用 [英] Undefined reference to `__ms_vsnprintf' when linking GLFW statically

查看:255
本文介绍了静态链接GLFW时未定义对__ms_vsnprintf的引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Windows中编译GLFW快速入门指南(此处) 8 64位使用mingw.我正在使用glfw网站上的官方32位Windows二进制文件.

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.

当我通过链接-lglfw3dll -lgdi32 -lopengl32 -lglew32并定义GLFW_DLL来动态链接glfw库时,一切正常.

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

但是,当我尝试静态链接glfw时,得到undefined reference to '__ms_vsnprintf'

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

我的静态链接命令是mingw32-g++.exe -o bin\Release\test.exe obj\Release\main.o -s -lglfw3 -lgdi32 -lopengl32 -lglew32s,定义了GLEW_STATIC.

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.

推荐答案

当我尝试为GLFW构建示例应用程序时遇到了同样的问题.我将编译器套件从原始的MinGW32切换到了MinGW-W64,从而解决了该问题.阅读这篇文章后,我想到了这个主意:

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

GLFW库似乎是用MinGW64或MinGW-W64构建的.

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

这篇关于静态链接GLFW时未定义对__ms_vsnprintf的引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆