2011-04-13 4 views
14

크로스 플랫폼 프레임 워크/라이브러리에 대한 조사가 진행됨에 따라 GLFW는 여러 번 언급되었습니다. 그래서, 나는 그것을 사용하기로 결정했다. 이제는 창을 초기화 할 수없는 것처럼 보입니다. : -/GLFW - 창을 열지 못했습니다.

 
#include 
#include 
#include 

int main(int argc, char *argv[]) 
{ 
    int running = GL_TRUE; 
    srand(time(NULL)); 

    if (!glfwInit()) 
     exit(EXIT_FAILURE); 

    if (!glfwOpenWindow(300, 300, 0, 0, 0, 0, 0, 0, GLFW_WINDOW)) 
    { 
     glfwTerminate(); 
     exit(EXIT_FAILURE); 
    } 

    while (running) 
    { 
     glClear(GL_COLOR_BUFFER_BIT); 
     glClearColor(rand() % 255 + 1, rand() % 255 + 1, rand() % 255 + 1, 0); 

     glfwSwapBuffers(); 

     running = !glfwGetKey(GLFW_KEY_ESC) && glfwGetWindowParam(GLFW_OPENED); 
    } 

    glfwTerminate(); 

    exit(EXIT_SUCCESS); 
} 

내가, ++ 2010 MVC이 입력 한 헤더, 2 개 lib에 링크 된 파일을 (그리고 1 개 DLL 파일을 가지고 있었다, 그래서 나는 SysWOW64와 폴더에 있음을 던졌다), 나는 이러한 오류를 얻을 :

1>------ Build started: Project: glfwTest, Configuration: Debug Win32 ------ 
1> test.cpp 
1>c:\users\andrew\documents\visual studio 2010\projects\glfwtest\glfwtest\test.cpp(8): warning C4244: 'argument' : conversion from 'time_t' to 'unsigned int', possible loss of data 
1>c:\users\andrew\documents\visual studio 2010\projects\glfwtest\glfwtest\test.cpp(22): warning C4244: 'argument' : conversion from 'int' to 'GLclampf', possible loss of data 
1>c:\users\andrew\documents\visual studio 2010\projects\glfwtest\glfwtest\test.cpp(22): warning C4244: 'argument' : conversion from 'int' to 'GLclampf', possible loss of data 
1>c:\users\andrew\documents\visual studio 2010\projects\glfwtest\glfwtest\test.cpp(22): warning C4244: 'argument' : conversion from 'int' to 'GLclampf', possible loss of data 
1>test.obj : error LNK2019: unresolved external symbol [email protected] referenced in function _main 
1>GLFW.lib(win32_window.obj) : error LNK2001: unresolved external symbol [email protected] 
1>test.obj : error LNK2019: unresolved external symbol [email protected] referenced in function _main 
1>GLFW.lib(window.obj) : error LNK2001: unresolved external symbol [email protected] 
1>GLFW.lib(win32_window.obj) : error LNK2001: unresolved external symbol [email protected] 
1>GLFW.lib(win32_window.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _initWGLExtensions 
1>GLFW.lib(win32_glext.obj) : error LNK2001: unresolved external symbol [email protected] 
1>GLFW.lib(win32_window.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _createWindow 
1>GLFW.lib(win32_window.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _createContext 
1>GLFW.lib(win32_window.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function _destroyWindow 
1>GLFW.lib(win32_window.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function __glfwPlatformSetWindowSize 
1>GLFW.lib(win32_window.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function __glfwPlatformSetWindowSize 
1>GLFW.lib(glext.obj) : error LNK2001: unresolved external symbol [email protected] 
1>GLFW.lib(glext.obj) : error LNK2019: unresolved external symbol [email protected] referenced in function __glfwParseGLVersion 
1>c:\users\andrew\documents\visual studio 2010\Projects\glfwTest\Debug\glfwTest.exe : fatal error LNK1120: 9 unresolved externals 
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ========== 

나는 임의의 색상으로 처음 몇 가지를 이해하지만 그 이후의 것들은 나에게 이해가 가지 않는다. 어떤 생각이 잘못된거야?

저는 libs를 올바르게 연결했는지 확신합니다. 나는 C : \ Program Files (x86) \ Microsoft Visual Studio 10.0 \ VC \ lib 디렉터리 에 넣고 심지어 내 C : \ SDK \ GLFW \ glfw-2.7.bin.WIN32 \ lib-msvc100에 연결했습니다. \ debug 디렉토리.

GLFW 패키지는 .zip 파일 이었기 때문에 모든 기본 API 폴더 (모든 API 및 기타 항목)에 압축을 풀었습니다. 그래서 C : \ SDK \ GLFW는 GLFW를위한 나의 기본값입니다.

답변

44

opengl32.lib에 링크해야합니다.

처럼 : opengl32.lib 제외하고 Linking to extra libs in Visual Studio

.

편집 : opengl32.lib 추가를 제외하고는 아무 것도 할 필요가 없습니다. 그 다른 것들은 무의미합니다. 또한 두 가지가 모두있는 경우 주문을 교환 해보십시오. 어떤 경우에는 중요합니다.

+0

opengl32.lib를 제외하고 opengl32.lib에 대한 링크가 있습니까? 그건 같은거야. : P하지만 고마워! 그것은 지금 일했다! : D – Imnotanerd

+1

오, 안돼 - 내가 그 말을 할 때 나는 그 그림을 언급하고 있었다. 데모로 사진을 올렸지 만,이 컴퓨터에 VS가 없어서 직접 스크린 샷을 찍을 수 없었습니다. –

+0

알았어, 도와 줘서 고마워! – Imnotanerd

관련 문제