2012-07-23 23 views
6

Estoy usando VC++ 2010 para trabajar con OpenGL. Sin embargo, se está convirtiendo en un dolor. Sigo recibiendo códigos de error una y otra vez.VC++ Errores de LNK con GLFW

Aquí está el código que estoy trabajando con:

// Include standard headers 
#include <stdio.h> 
#include <stdlib.h> 


// Include GLEW 
#include <GL/glew.h> 

// Include GLFW 
#include <GL/glfw.h> 


// Include GLM 
#include <glm/glm.hpp> 
using namespace glm; 
int main(void){   
    // Initialise GLFW 
    if(!glfwInit()){ 

      fprintf(stderr, "Failed to initialize GLFW\n"); 
      return -1; 
    } 

    glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4); 
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3); 
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3); 
    glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); 

    // Open a window and create its OpenGL context 
    if(!glfwOpenWindow(1024, 768, 0,0,0,0, 32,0, GLFW_WINDOW)) 
    { 
      fprintf(stderr, "Failed to open GLFW window. If you have an Intel GPU, they are not 3.3 compatible. Try the 2.1 version of the tutorials.\n"); 
      glfwTerminate(); 
      return -1; 
    } 

    // Initialize GLEW 
    if (glewInit() != GLEW_OK) { 
      fprintf(stderr, "Failed to initialize GLEW\n"); 
      return -1; 
    } 

    glfwSetWindowTitle("Tutorial 01"); 

    // Ensure we can capture the escape key being pressed below 
    glfwEnable(GLFW_STICKY_KEYS); 

    // Dark blue background 
    glClearColor(0.0f, 0.0f, 0.3f, 0.0f); 

    do{ 
     // Draw nothing, see you in tutorial 2 ! 

     // Swap buffers 
     glfwSwapBuffers(); 

    } // Check if the ESC key was pressed or the window was closed 
    while(glfwGetKey(GLFW_KEY_ESC) != GLFW_PRESS && 
     glfwGetWindowParam(GLFW_OPENED)); 

// Close OpenGL window and terminate GLFW 
    glfwTerminate(); 
    return 0; 
} 

Estos son los errores que estoy recibiendo:

Error 52 error LNK1120: 10 unresolved externals C:\Users\Chefomsky\documents\visual studio 2010\Projects\OpenGL Fun\Debug\OpenGL Fun.exe OpenGL Fun 
Error 42 error LNK2001: unresolved external symbol [email protected] C:\Users\Chefomsky\documents\visual studio 2010\Projects\OpenGL Fun\OpenGL Fun\GLFW.lib(win32_window.obj) OpenGL Fun 
Error 39 error LNK2001: unresolved external symbol [email protected] C:\Users\Chefomsky\documents\visual studio 2010\Projects\OpenGL Fun\OpenGL Fun\GLFW.lib(win32_window.obj) OpenGL Fun 
Error 50 error LNK2001: unresolved external symbol [email protected] C:\Users\Chefomsky\documents\visual studio 2010\Projects\OpenGL Fun\OpenGL Fun\GLFW.lib(glext.obj) OpenGL Fun 
Error 45 error LNK2001: unresolved external symbol [email protected] C:\Users\Chefomsky\documents\visual studio 2010\Projects\OpenGL Fun\OpenGL Fun\GLFW.lib(win32_glext.obj) OpenGL Fun 
Error 41 error LNK2019: unresolved external symbol [email protected] referenced in function _glfwOpenWindow C:\Users\Chefomsky\documents\visual studio 2010\Projects\OpenGL Fun\OpenGL Fun\GLFW.lib(window.obj) OpenGL Fun 
Error 38 error LNK2019: unresolved external symbol [email protected] referenced in function _main C:\Users\Chefomsky\documents\visual studio 2010\Projects\OpenGL Fun\OpenGL Fun\Main.obj OpenGL Fun 
Error 40 error LNK2019: unresolved external symbol [email protected] referenced in function _main C:\Users\Chefomsky\documents\visual studio 2010\Projects\OpenGL Fun\OpenGL Fun\Main.obj OpenGL Fun 
Error 48 error LNK2019: unresolved external symbol [email protected] referenced in function __glfwPlatformSetWindowSize C:\Users\Chefomsky\documents\visual studio 2010\Projects\OpenGL Fun\OpenGL Fun\GLFW.lib(win32_window.obj) OpenGL Fun 
Error 49 error LNK2019: unresolved external symbol [email protected] referenced in function __glfwPlatformSetWindowSize C:\Users\Chefomsky\documents\visual studio 2010\Projects\OpenGL Fun\OpenGL Fun\GLFW.lib(win32_window.obj) OpenGL Fun 
Error 51 error LNK2019: unresolved external symbol [email protected] referenced in function __glfwParseGLVersion C:\Users\Chefomsky\documents\visual studio 2010\Projects\OpenGL Fun\OpenGL Fun\GLFW.lib(glext.obj) OpenGL Fun 
Error 43 error LNK2019: unresolved external symbol [email protected] referenced in function _createContext C:\Users\Chefomsky\documents\visual studio 2010\Projects\OpenGL Fun\OpenGL Fun\GLFW.lib(win32_window.obj) OpenGL Fun 
Error 47 error LNK2019: unresolved external symbol [email protected] referenced in function _destroyWindow C:\Users\Chefomsky\documents\visual studio 2010\Projects\OpenGL Fun\OpenGL Fun\GLFW.lib(win32_window.obj) OpenGL Fun 
Error 44 error LNK2019: unresolved external symbol [email protected] referenced in function _initWGLExtensions C:\Users\Chefomsky\documents\visual studio 2010\Projects\OpenGL Fun\OpenGL Fun\GLFW.lib(win32_window.obj) OpenGL Fun 
Error 46 error LNK2019: unresolved external symbol [email protected] referenced in function _createWindow C:\Users\Chefomsky\documents\visual studio 2010\Projects\OpenGL Fun\OpenGL Fun\GLFW.lib(win32_window.obj) OpenGL Fun 

Respuesta

10

En el explorador de soluciones, haga clic con su proyecto y seleccione properties. En el cuadro de lista de configuración, seleccione "todas las configuraciones". En el panel izquierdo, seleccione el subárbol Linker y luego la opción input. Agregue opengl32.lib en "Dependencias Adicionales".

+0

estoy alféizar de conseguir algunos errores de error LNK1120 de error: 1 de externos sin resolver \t C: \ Users \ Chefomsky \ documentos \ Visual Studio 2010 \ Projects \ OpenGL Diversión \ Debug \ OpenGL Fun.exe \t OpenGL FunError error LNK2019: símbolo externo sin resolver __imp__glewInit @ 0 hace referencia en función de _main \t C: \ Users \ Chefomsky \ documentos \ visual Studio 2010 \ Projects \ OpenGL Diversión \ OpenGL Diversión \ Main.obj \t OpenGL Diversión – NateAGeek

+0

@ NathanHatch- Martinez: Para el error LNK1120, vea [este enlace] (http://stackoverflow.com/a/7410844/716076). Para el LNK2019, recomiendo [este enlace] (http://msdn.microsoft.com/en-us/library/799kze2z%28v=vs.80%29.aspx). –

+0

Ok, nota al margen: utilicé las librerías incorrectas ... Gracias por su ayuda. – NateAGeek

Cuestiones relacionadas