Partage
  • Partager sur Facebook
  • Partager sur Twitter

OpenGL

execution

    29 août 2007 à 20:21:39

    je me suis lancé dans le tuto sur l'OpenGL et j'ai un probleme au premiere exercice (le triangle).

    Lorsque je compile, aucune erreur n'est déclarée. Mais lors de l'execution, j'ai ces 8 erreurs (je bosse sur Visual C++ 6.0):

    1. Linking...
    2. 1.obj : error LNK2001: unresolved external symbol _SDL_Quit
    3. 1.obj : error LNK2001: unresolved external symbol _SDL_GL_SwapBuffers
    4. 1.obj : error LNK2001: unresolved external symbol _SDL_WaitEvent
    5. 1.obj : error LNK2001: unresolved external symbol _SDL_SetVideoMode
    6. 1.obj : error LNK2001: unresolved external symbol _SDL_WM_SetCaption
    7. 1.obj : error LNK2001: unresolved external symbol _SDL_Init
    8. LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
    9. Debug/Test5.exe : fatal error LNK1120: 7 unresolved externals
    10. Error executing link.exe.
    11. Test5.exe - 8 error(s), 0 warning(s)


    J'ai pensé qu'il s'agissait d'un problème de librairie, mais ayant ajouté opengl32.lib et glu32.lib aux options du projet, je ne vois pas ce qui manque.


    programme:

    1. #include <windows.h>
    2. #include <SDL.h>
    3. #include <GL/gl.h>
    4. #include <GL/glu.h>
    5. int main(int argc, char *argv[])
    6. {
    7.     SDL_Init(SDL_INIT_VIDEO);
    8.     SDL_WM_SetCaption("Mon premier programme OpenGL !",NULL);
    9.     SDL_SetVideoMode(640, 480, 32, SDL_OPENGL);
    10.     bool continuer = true;
    11.     SDL_Event event;
    12.     while (continuer)
    13.     {
    14.         SDL_WaitEvent(&event);
    15.         switch(event.type)
    16.         {
    17.             case SDL_QUIT:
    18.                 continuer = false;
    19.         }
    20.          glClear(GL_COLOR_BUFFER_BIT);
    21.         glBegin(GL_TRIANGLES);
    22.             glColor3ub(255,0,0);    glVertex2d(-0.75,-0.75);
    23.             glColor3ub(0,255,0);    glVertex2d(0,0.75);
    24.             glColor3ub(0,0,255);    glVertex2d(0.75,-0.75);
    25.         glEnd();
    26.         glFlush();
    27.         SDL_GL_SwapBuffers();
    28.     }
    29.     SDL_Quit();
    30.     return 0;
    31. }
    • Partager sur Facebook
    • Partager sur Twitter
      29 août 2007 à 20:25:53

      Est-ce que tu as aussi linké les biblios pour la SDL?
      • Partager sur Facebook
      • Partager sur Twitter
        29 août 2007 à 20:28:43

        non, j'avais oublié SDL.lib, merci beaucoup. Je passe de 8 a 2 erreurs:

        1. Linking...
        2. LIBCD.lib(wincrt0.obj) : error LNK2001: unresolved external symbol _WinMain@16
        3. Debug/Test5.exe : fatal error LNK1120: 1 unresolved externals
        4. Error executing link.exe.
        5. Test5.exe - 2 error(s), 0 warning(s)
        • Partager sur Facebook
        • Partager sur Twitter
          29 août 2007 à 21:25:37

          Je viens de le rajouter et j'ai à présent 4 erreurs:

          1. Linking...
          2. msvcrt.lib(MSVCRT.dll) : error LNK2005: _exit already defined in LIBCD.lib(crt0dat.obj)
          3. msvcrt.lib(MSVCRT.dll) : error LNK2005: _fclose already defined in LIBCD.lib(fclose.obj)
          4. msvcrt.lib(MSVCRT.dll) : error LNK2005: __isctype already defined in LIBCD.lib(isctype.obj)
          5. LIBCD.lib(crt0init.obj) : warning LNK4098: defaultlib "msvcrt.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
          6. Debug/Test5.exe : fatal error LNK1169: one or more multiply defined symbols found
          7. Error executing link.exe.
          8. Test5.exe - 4 error(s), 1 warning(s)
          • Partager sur Facebook
          • Partager sur Twitter

          OpenGL

          × Après avoir cliqué sur "Répondre" vous serez invité à vous connecter pour que votre message soit publié.
          × Attention, ce sujet est très ancien. Le déterrer n'est pas forcément approprié. Nous te conseillons de créer un nouveau sujet pour poser ta question.
          • Editeur
          • Markdown