Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
5257 connectés 

 


Dernière réponse
Sujet : problème, les focntions opengl me donnent unresolved external symbol
Pitounet de rien  :jap:

Votre réponse
Nom d'utilisateur    Pour poster, vous devez être inscrit sur ce forum .... si ce n'est pas le cas, cliquez ici !
Le ton de votre message                        
                       
Votre réponse


[b][i][u][strike][spoiler][fixed][cpp][url][email][img][*]   
 
   [quote]
 

Options

 
Vous avez perdu votre mot de passe ?


Vue Rapide de la discussion
Pitounet de rien  :jap:
oups j'avais po lié opengl32.lib et glu32.lib.
 
merci à vous, maintenant ca marche :)
Pitounet vu les messages d'erreur, les include semblent bien se passer. Je pense vriament que le pb vient des library opengl qui ne sont pas inclues dans le projet...
koulip31 heu aussi  
oure les .h
gl/...
 
faut les mettre dans un dossire GL dans le dossier des include  
 
(ca mettais arrive et i avait pas pense)
Pitounet Tu as ajouté glu32.lib et opengl32.lib dans ton projet ???
 
Si tu ne l'as pas fait, ton pb vient de là !
Dans visual C++ , il faut aller dans Project/Settings. Dans l'onglet Link, tu ajoutes ces deux fichiers dans la liste object/Library Modules.
pourtant j'ai bien içnclus gl.h et glu.h, j'ai verifié les fichiers sont bien présents.
j'ai aussi réinstallé glsetup.
 
pourtant dans visual c++ 6 dès que j'essaie d'utiliser des focn tions opengl c'est unresolved external symbol.
exemple:
 

Code :
  1. siource.obj : error LNK2001: unresolved external symbol __imp__wglCreateContext@4
  2. siource.obj : error LNK2001: unresolved external symbol __imp__wglDeleteContext@4
  3. siource.obj : error LNK2001: unresolved external symbol __imp__wglMakeCurrent@8
  4. siource.obj : error LNK2001: unresolved external symbol __imp__glVertex3i@12
  5. siource.obj : error LNK2001: unresolved external symbol __imp__glEnd@0
  6. siource.obj : error LNK2001: unresolved external symbol __imp__glVertex2i@8
  7. siource.obj : error LNK2001: unresolved external symbol __imp__glBegin@4
  8. siource.obj : error LNK2001: unresolved external symbol __imp__glScaled@24
  9. siource.obj : error LNK2001: unresolved external symbol __imp__glRotated@32
  10. siource.obj : error LNK2001: unresolved external symbol _gluLookAt@72
  11. siource.obj : error LNK2001: unresolved external symbol __imp__glLoadIdentity@0
  12. siource.obj : error LNK2001: unresolved external symbol __imp__glMatrixMode@4
  13. siource.obj : error LNK2001: unresolved external symbol __imp__glClear@4
  14. siource.obj : error LNK2001: unresolved external symbol _gluPerspective@32
  15. siource.obj : error LNK2001: unresolved external symbol __imp__glViewport@16


 
le source est hors de cause car il vient d'un didactitiel, et il amrche chez un pote.
je vous le met au cas où ...
 

Code :
  1. #include <windows.h>
  2. #include <gl/gl.h>
  3. #include <gl/glu.h>
  4. #include <math.h>
  5. void Draw();
  6. void Reshape(int width,int height);
  7. void InitGL();
  8. void SetupPixelFormat(HDC hDC);
  9. LRESULT CALLBACK WinProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
  10. HINSTANCE HInst;
  11. HDC   DC;
  12. HGLRC  RC;
  13. double a=0,b=0; //Angles
  14. double d=10; //Distance
  15. double f=1;  //Facteur d'agrandissement
  16. //////////////////////////////////////////////////
  17. //////////////////////////
  18. int WINAPI WinMain(     HINSTANCE hInstance, 
  19.                         HINSTANCE hPrevInstance, 
  20.                         LPSTR lpCmdLine, 
  21.                         int nCmdShow)
  22. {
  23. HInst = hInstance;
  24. WNDCLASS WindowClass =
  25. {
  26.  0,
  27.  WinProc,
  28.  0,
  29.  0,
  30.  HInst,
  31.  0,
  32.  0,
  33.  0,
  34.  NULL,
  35.  "La classe !",
  36. };
  37. if (!RegisterClass( &WindowClass)) exit(1);
  38. HWND OpenGLWindow = CreateWindow( "La classe !",   //Classe de la fenêtre
  39.                                       "Fenêtre OpenGL",   //Nom de la fenêtre
  40.                                       WS_VISIBLE | WS_SYSMENU, //Caractéristiques
  41.                                       0,      //Position x
  42.                                       0,      //Position y
  43.                                       320,      //Largeur
  44.                                       200,      //Hauteur
  45.                                       0,      //Handle de la fenêtre mère
  46.                                       0,      //Identifiant de la fenêtre fille
  47.                                       HInst,     //HINSTANCE du programme
  48.                                       NULL);     /*Chaine de caractère envoyée
  49.                en paramètre lors de la création
  50.                de la fenêtre*/
  51. if (!OpenGLWindow) exit(1);
  52. MSG msg;
  53. do
  54. {
  55.  while (PeekMessage(&msg,OpenGLWindow,0,0,PM_NOREMOVE))
  56.  {
  57.   if(GetMessage(&msg,OpenGLWindow,0,0))
  58.   {
  59.    DispatchMessage(&msg);
  60.   }
  61.   else return 0;
  62.  }
  63. }
  64. while(1);
  65. return 0;//Pour la forme
  66. }
  67. /////////////////////////////////////////////////////////////////////////////
  68. void SetupPixelFormat(HDC hDC)
  69. {
  70.     PIXELFORMATDESCRIPTOR pfd = {
  71.         sizeof(PIXELFORMATDESCRIPTOR), //taille du descripteur de format
  72.  1,        //version
  73.         PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW | PFD_DOUBLEBUFFER, //Propriétés
  74.         PFD_TYPE_RGBA,     //Mode de couleurs
  75.         16,        //Bits de couleur
  76.         0, 0, 0, 0, 0, 0,    //Paramètres des couleurs
  77.         0, 0,       //Paramètres alpha
  78.         0, 0, 0, 0, 0,     //Paramètres du buffer d'accumulation
  79.         32,        //Bits de profondeur
  80.         0,        //Bits du buffer stencil  
  81.         0,        //Nombre de buffers auxiliaires
  82.         0,        //ignoré (obsolète)
  83.         0,        //réservé
  84.         0,        //ignoré (obsolète)
  85.         0,        //Couleur de transparence
  86.         0        //Ignoré (obsolète)
  87. };
  88.     int pixelFormat;
  89.     pixelFormat = ChoosePixelFormat(hDC, &pfd);
  90.     if (pixelFormat == 0) {
  91.         MessageBox(WindowFromDC(hDC), "Mode graphique non supporté par le driver.", "Problème",
  92.                 MB_ICONERROR | MB_OK);
  93.         exit(1);
  94.     }
  95.     if (SetPixelFormat(hDC, pixelFormat, &pfd) != TRUE) {
  96.         MessageBox(WindowFromDC(hDC), "Mode graphique non supporté par le driver.", "Problème",
  97.                 MB_ICONERROR | MB_OK);
  98.         exit(1);
  99.     }
  100. }
  101. /////////////////////////////////////////////////////////////////////////////
  102. LRESULT CALLBACK WinProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
  103. {
  104. switch(uMsg)
  105. {
  106. case WM_CLOSE:
  107.  wglMakeCurrent(NULL, NULL);
  108.  if (RC) wglDeleteContext(RC);
  109.  ReleaseDC(hwnd,DC);
  110.  PostQuitMessage(0);
  111.  break;
  112. case WM_CREATE:
  113.  DC=GetDC(hwnd);
  114.  SetupPixelFormat(DC);
  115.  RC = wglCreateContext(DC);
  116.  if (!RC) SendMessage(hwnd,WM_CLOSE,0,0);
  117.  wglMakeCurrent(DC, RC);
  118.  InitGL();
  119.  break;
  120. case WM_SIZE:
  121.  Reshape(LOWORD(lParam),HIWORD(lParam));
  122.  break;
  123. case WM_PAINT:
  124.  Draw();
  125.  break;
  126. default:
  127.  return DefWindowProc(hwnd,uMsg,wParam,lParam);
  128.  break;
  129. }
  130. return 0;
  131. }
  132. /////////////////////////////////////////////////////////////////////////////
  133. void InitGL()
  134. {
  135. }
  136. //////////////////////////////////////////////////
  137. ///////////////////////////
  138. void Draw()
  139. {
  140. a+=0.5;
  141. b+=.4;
  142. d=10.+cos(a/30.)*2.;
  143. f=1.+cos(a/5.)/5.;
  144. glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  145. glMatrixMode(GL_MODELVIEW);
  146. glLoadIdentity();
  147. gluLookAt(0,0,d,0,0,0,0,1,0);
  148. glRotated(a,0,1,0);
  149. glRotated(b,1,0,0);
  150. glScaled(f,f,2-f);
  151. glBegin(GL_LINE_LOOP);
  152.  glVertex2i(-1,-1);
  153.  glVertex2i(1,-1);
  154.  glVertex2i(1,1);
  155.  glVertex2i(-1,1);
  156. glEnd();
  157. glBegin(GL_LINES);
  158.  glVertex2i(-1,-1);glVertex3i(0,0,2);
  159.  glVertex2i(1,-1);glVertex3i(0,0,2);
  160.  glVertex2i(1,1);glVertex3i(0,0,2);
  161.  glVertex2i(-1,1);glVertex3i(0,0,2);
  162. glEnd();
  163. SwapBuffers(DC);
  164. }
  165. //////////////////////////////////////////////////////////////////////////
  166. ///
  167. void Reshape(int width,int height)
  168. {
  169. glViewport(0,0,width,height);
  170. glMatrixMode(GL_PROJECTION);
  171. glLoadIdentity();
  172. gluPerspective(45.,float(width)/float(height),0,100);
  173. }
  174. //Fin////////////////////////////////////////////////////////////////////////


 
 
des idées ? ca vous est deja arrivé ?


Copyright © 1997-2025 Groupe LDLC (Signaler un contenu illicite / Données personnelles)