IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

OpenGL Discussion :

Problème avec glew et code::blocks


Sujet :

OpenGL

  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Août 2006
    Messages
    199
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 199
    Par défaut Problème avec glew et code::blocks
    Salut,

    Je souhaiterais utiliser la librairie glew pour gérer mes extensions mais j'ai un souci sous code::blocks. J'ai téléchargé le pack binaire pour Windows, jai mis le .lib dans le repertoire lib de code::blocks et glew.h dans le repertoire include, j'ai ajouté cette lib au projet à la suite de mingw32; SDLmain, SDL, opengl32 et glu32 et enfin j'ai ajouter glew.h juste avant gl.h et bilan : j'ai un problème de link. Est-ce parce que code::blocks utilise habituellement des .a?

  2. #2
    Rédacteur
    Avatar de Laurent Gomila
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2003
    Messages
    10 651
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2003
    Messages : 10 651
    Par défaut
    Ca ne répond pas forcément à ta question, mais personnellement j'ai choisi d'ajouter à mon projet les sources (un seul fichier glew.c) plutôt que de lier avec la bibliothèque précompilée.

    Comme ça quelque soit ton compilo tu seras tranquille.

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Août 2006
    Messages
    199
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 199
    Par défaut
    j'ai ajouté glew.h et glew.c à mon projet (en enlevant les lib) mais j'ai toujours un problème de link
    Il me dit ça :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    glew.c:4847: undefined reference to `_imp__glewExperimental'
    glew.c:4850: undefined reference to `_imp__glewExperimental'
    glew.c:4853: undefined reference to `_imp__glewExperimental'
    glew.c:4856: undefined reference to `_imp__glewExperimental'
    glew.c:4859: undefined reference to `_imp__glewExperimental'
    glew.c:4866: more undefined references to `_imp__glewExperimental' follow
    :: === Build finished: 6 errors, 0 warnings ===

  4. #4
    Rédacteur
    Avatar de Laurent Gomila
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2003
    Messages
    10 651
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2003
    Messages : 10 651
    Par défaut
    Essaye de définir la macro GLEW_STATIC au niveau de ton projet, ça devrait lui dire que tu l'utilises directement et non sous forme de bibliothèque dynamique.

  5. #5
    Membre confirmé
    Profil pro
    Inscrit en
    Août 2006
    Messages
    199
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 199
    Par défaut
    j'ai ajouté ça juste avant l'inclusion de glew.h
    mais j'ai toujours les mêmes erreures

  6. #6
    Rédacteur
    Avatar de Laurent Gomila
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2003
    Messages
    10 651
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2003
    Messages : 10 651
    Par défaut
    Ajoute le plutôt dans les options de ton projet.

  7. #7
    Membre confirmé
    Profil pro
    Inscrit en
    Août 2006
    Messages
    199
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 199
    Par défaut
    J'ai ajouté GLEW_STATIC dans project/build options à l'onglet #define mais cette fois j'ai plus de 50 erreures et il me parle de SDL. Mon ordre d'inclusion est il correct?
    Voici mon main.h, je l'inclus dans tous mes autres .h ainsi que dans le main.cpp
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    #ifndef _MAIN_H
    #define _MAIN_H
     
     
    #include <stdio.h>
    #include <stdlib.h>
    #include <math.h>
    #include <SDL/SDL.h>
    #include <SDL/SDL_image.h>
    #include <gl/glew.h>
    #include <gl/gl.h>						
    #include <gl/glu.h>						
     
     
    #endif
    Pour ce qui est des lib inclues j'ai mis, dans l'ordre, mingw32, SDLmain, SDL, opengl32 et glu32

  8. #8
    Rédacteur
    Avatar de Laurent Gomila
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2003
    Messages
    10 651
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2003
    Messages : 10 651
    Par défaut
    mais cette fois j'ai plus de 50 erreures
    Quel genre ?

    Mon ordre d'inclusion est il correct?
    Essaye de placer les gl avant les SDL.

    Sinon autre solution... Crée un projet avec glew.c et glew.h, et compile le en bibliothèque statique. Enfin à toi de voir ce que tu trouves plus pratique.

  9. #9
    Membre confirmé
    Profil pro
    Inscrit en
    Août 2006
    Messages
    199
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 199
    Par défaut
    ce genre là
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    -------------- Build: Debug in moteur graphique ---------------
    Compiling: camera.cpp
    In file included from ./main.h:24,
                     from ./camera.h:21,
                     from camera.cpp:17:
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:28:22: SDL_main.h: No such file or directory
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:29:24: SDL_stdinc.h: No such file or directory
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:30:23: SDL_audio.h: No such file or directory
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:31:23: SDL_cdrom.h: No such file or directory
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:32:25: SDL_cpuinfo.h: No such file or directory
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:33:24: SDL_endian.h: No such file or directory
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:34:23: SDL_error.h: No such file or directory
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:35:24: SDL_events.h: No such file or directory
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:36:24: SDL_loadso.h: No such file or directory
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:37:23: SDL_mutex.h: No such file or directory
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:38:23: SDL_rwops.h: No such file or directory
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:39:24: SDL_thread.h: No such file or directory
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:40:23: SDL_timer.h: No such file or directory
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:41:23: SDL_video.h: No such file or directory
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:42:25: SDL_version.h: No such file or directory
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:44:24: begin_code.h: No such file or directory
    In file included from ./main.h:24,
                     from ./camera.h:21,
                     from camera.cpp:17:
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:69: error: expected init-declarator before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:69: error: expected `,' or `;' before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:72: error: expected init-declarator before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:72: error: expected `,' or `;' before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:75: error: expected init-declarator before "void"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:75: error: expected `,' or `;' before "void"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:81: error: `DECLSPEC' does not name a type
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:86: error: expected init-declarator before "void"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:86: error: expected `,' or `;' before "void"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL.h:92:24: close_code.h: No such file or directory
    In file included from ./main.h:25,
                     from ./camera.h:21,
                     from camera.cpp:17:
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:28:17: SDL.h: No such file or directory
    In file included from ./main.h:25,
                     from ./camera.h:21,
                     from camera.cpp:17:
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:57: error: expected init-declarator before "const"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:57: error: expected `,' or `;' before "const"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:67: error: `DECLSPEC' does not name a type
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:69: error: `DECLSPEC' does not name a type
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:70: error: `DECLSPEC' does not name a type
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:75: error: expected init-declarator before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:75: error: expected `,' or `;' before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:78: error: expected init-declarator before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:78: error: expected `,' or `;' before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:79: error: expected init-declarator before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:79: error: expected `,' or `;' before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:80: error: expected init-declarator before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:80: error: expected `,' or `;' before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:81: error: expected init-declarator before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:81: error: expected `,' or `;' before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:82: error: expected init-declarator before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:82: error: expected `,' or `;' before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:83: error: expected init-declarator before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:83: error: expected `,' or `;' before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:84: error: expected init-declarator before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:84: error: expected `,' or `;' before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:85: error: expected init-declarator before "int"
    C:/Program Files/CodeBlocks/bin/../lib/gcc/mingw32/3.4.4/../../../../mingw32/include/SDL/SDL_image.h:85: error: expected `,' or `;' before "int"
    Process terminated with status 1 (0 minutes, 0 seconds)
    50 errors, 0 warnings
    J'ai essayé l'échange des lib OpenGL et SDL mais ça ne change rien.

  10. #10
    Membre confirmé
    Profil pro
    Inscrit en
    Août 2006
    Messages
    199
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Août 2006
    Messages : 199
    Par défaut
    oups, pour les 50 erreurs, j'avais modifié les paramètres du projet
    je suis donc toujours avec mes erreurs du départ.

  11. #11
    Membre averti
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    22
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 22
    Par défaut
    Je me permet de "réupper" (bis) ce topic parce que j'ai exactement le même problème que ci-dessus : impossible de creer un projet (codeblock) avec glew.
    En ajoutant a mon projet vide glew.h, apres avoir mis les fichiers .h de glew dans le dossier include/GL de codeblock et ajouté le fichier glew32.lib aux librairies de link, j'obtient l'erreur undefined reference to `_imp__glewExperimental' .
    Ayant déja cherché ici, j'ai lu qu'il fallait ajouter un #define GLEW_STATIC mais rien n'y fait.
    De plus j'ai trouvé d'autres librairies (libglew32.dll.a et libglew32.a) mais je suis un peu perdu sur la manière de procéder.

    Queuqu'un pourrait-t-il m'expliquer concretement comment faire ?
    Le mieux etant que l'on puisse me passer un projet codeblock fonctionnel afin que je comprenne enfin comment tout cela fonctionne.

    Merci par avance

  12. #12
    Rédacteur
    Avatar de Laurent Gomila
    Profil pro
    Développeur informatique
    Inscrit en
    Avril 2003
    Messages
    10 651
    Détails du profil
    Informations personnelles :
    Âge : 41
    Localisation : France, Moselle (Lorraine)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Avril 2003
    Messages : 10 651
    Par défaut
    Etant donné que tu utilises Code::Blocks, j'imagine que tu compiles avec MinGW. Dans ce cas libglew32.a te servira à lier GLEW statiquement à ton projet (ajoute -lglew32 dans les options d'édition de liens).

    Il faut quand même définir GLEW_STATIC (options de compilation : -DGLEW_STATIC), sinon l'éditeur de lien tentera d'importer les fonctions dynamiquement plutôt que de les lier statiquement.

  13. #13
    Membre averti
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    22
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2007
    Messages : 22
    Par défaut
    J'ai rajouté -lglew32 comme tu l'as dit et ça fonctionne impec'.
    Merci beaucoup !

  14. #14
    Membre émérite
    Avatar de Gouyon
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Novembre 2003
    Messages
    1 138
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 61
    Localisation : France, Loiret (Centre)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : Aéronautique - Marine - Espace - Armement

    Informations forums :
    Inscription : Novembre 2003
    Messages : 1 138
    Billets dans le blog
    5
    Par défaut
    J'ai le même problème sauf qu’après avoir suivi vos indications j'ai l'erreur suivante:

    ld.exe cannot find -lglew32.lib

  15. #15
    Expert confirmé
    Avatar de Kannagi
    Homme Profil pro
    cyber-paléontologue
    Inscrit en
    Mai 2010
    Messages
    3 226
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Bouches du Rhône (Provence Alpes Côte d'Azur)

    Informations professionnelles :
    Activité : cyber-paléontologue

    Informations forums :
    Inscription : Mai 2010
    Messages : 3 226
    Par défaut
    ton errer dit que il ne trouve pas -lglew32.lib .
    On peut connaitre exactement les option de compilation/link que tu as mis ?

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 9
    Dernier message: 06/10/2007, 22h06
  2. Problème avec "update" du code ASP
    Par ocean_prince11 dans le forum ASP
    Réponses: 14
    Dernier message: 24/11/2006, 18h56
  3. Réponses: 5
    Dernier message: 09/04/2006, 19h02
  4. Problème avec les inlines, et block
    Par Oberown dans le forum Mise en page CSS
    Réponses: 2
    Dernier message: 16/12/2004, 12h03

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo