簡體   English   中英

“對_ms_vsnprintf的未定義引用”

[英]“Undefined reference to _ms_vsnprintf”

我知道我做了什么。 這是我正在使用的庫之一。 它引用了_ms__vsnprintf 我刪除了文件,並編譯了程序。 謝謝你的幫助。 供以后參考,文件為libglfw3.a

如何解決錯誤“對_ms_vsnprintf的未定義引用”? 我只看過另一篇關於它的文章,但這並不能解決我的問題。 我正在使用Windows 8,Code :: Blocks和MinGW。 這是我的代碼。

#define __LCC__
#define GLEW_STATIC
#define GLFWAPI __declspec(dllimport)
#include <stdio.h>
#include <stdlib.h>
#include <GL/glew.h>
#define GLFW_INCLUDE_GLU
#include <GL/glfw3.h>
#include <glm/glm.hpp>
using namespace glm;
int main() {
if( !glfwInit() ) {
    fprintf( stderr, "Failed to initialize GLFW\n");
    return -1;
}
 glfwWindowHint(GLFW_SAMPLES, 4);
 glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
 glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
 glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);

GLFWwindow* window;
window = glfwCreateWindow( 600, 800, "OpenGL Window", NULL, NULL);

if(window == NULL) {
    fprintf(stderr, "OpenGL Couldn't open the window.\n");
    glfwTerminate();
    return -1;
}

glfwMakeContextCurrent(window);
glewExperimental=true;
if (glewInit() !=GLEW_OK) {
    fprintf(stderr, "Failed to start GLEW.\n");
    return -1;
}
 }

這是Code :: Blocks的構建日志

-------------- Build: Debug in opengltest (compiler: GNU GCC Compiler)---------------

mingw32-g++.exe -lglfw3 -Wall -g -I..\..\MiniGW\lib\lib-mingw-w64 -c "D:\Programs\C PROGRAMS\opengltest\main.cpp" -o obj\Debug\main.o
mingw32-g++.exe -L..\..\MiniGW\lib\lib-mingw-w64 -L..\MiniGW\lib -o bin\Debug\opengltest.exe obj\Debug\main.o  -lglfw3 -lglfw3 -lopengl32 -lgdi32 -lglu32  ..\..\MiniGW\lib\Release\Win32\glew32s.lib ..\..\MiniGW\lib\lib-mingw-w64\glfw3dll.a ..\..\MiniGW\lib\lib-mingw-w64\libglfw3.a ..\..\MiniGW\lib\libglu32.a ..\..\MiniGW\lib\libopengl32.a
Warning: corrupt .drectve at end of def file
..\..\MiniGW\lib\lib-mingw-w64/libglfw3.a(init.c.obj):init.c:(.text+0x49): undefined reference to `__ms_vsnprintf'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 13 second(s))
1 error(s), 1 warning(s) (0 minute(s), 13 second(s))

我用答案編輯了問題。 刪除libglfw3.a后將其修復。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM