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

C++ Discussion :

erreur de compilation


Sujet :

C++

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    64
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2009
    Messages : 64
    Points : 40
    Points
    40
    Par défaut erreur de compilation
    Bonsoir,

    Ca fait un petit moment que je cherche, et je ne vois pas ce qui ne va pas.
    Lorsque je compile le programme j'obtiens :

    [ 30%] Building CXX object CMakeFiles/tuxworld.dir/src/game/screen_wait.cpp.o
    /home/lydia/tuxw_svn6/tuxworld/src/game/screen_wait.cpp: In function ‘void screen_wait(s_game&, SDL_Event&, bool, std::string&, const float&, const int&, const bool&)’:
    /home/lydia/tuxw_svn6/tuxworld/src/game/screen_wait.cpp:82:25: erreur: ‘class CAnimation’ has no member named ‘show_kinect’
    make[2]: *** [CMakeFiles/tuxworld.dir/src/game/screen_wait.cpp.o] Erreur 1
    make[1]: *** [CMakeFiles/tuxworld.dir/all] Erreur 2
    make: *** [all] Erreur 2
    Je vais voir la ligne 82 (ici ligne 19) de screen_wait.cpp et je lis :

    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
             #if KINECT_COMP == 1
    
             if(game.kinect)
             if(show_bk) {
    
                // we lock the thread
                data_kinect.th->lock();
    
                // recover the squeleton
                skl = data_kinect.squel;
    
                // unlock the thread
                data_kinect.th->unlock();
    
                // draw the hand_cursor
                glPushMatrix();
                glTranslatef((SIZE_TEXTURE_W_MAX / 2 - CAM_W / 2) * game.coef_resol, (SIZE_TEXTURE_H_MAX / 2 - CAM_H / 2) * game.coef_resol, 0);
                hand_cursor.object_move(skl.hand0.x, skl.hand0.y);
                hand_cursor.show_kinect(NO_LOOP, false, 1, .4f);
    
                glPopMatrix();
    
                // draw stars buttons
                kin_button.draw(SIZE_TEXTURE_W_MAX / 2 - CAM_W / 2, SIZE_TEXTURE_H_MAX / 2 - CAM_H / 2 + CAM_H - 100, -.3);
                // test hands on stars button
                if(kin_button.select(SIZE_TEXTURE_W_MAX / 2 - CAM_W / 2 + skl.hand0.x, SIZE_TEXTURE_H_MAX / 2 - CAM_H / 2 + skl.hand0.y))
                   --ready;
                else
                   ready = 40;
                   
                if(!ready && !stage_screen) {
                   stage_screen = true;
                   ++i;
                }
             }
    
             #endif
    Mon include #include"animation.h" est bien présent dans screen_wait.h.

    dans mon animation.h j'ai bien

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
          #if KINECT_COMP == 1
          // show without scale for kinect
          void show_kinect(const int& loop_type, const bool& orientation, const int& step, const float& deep);
          #endif
    et mon animation.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
    16
    17
    #if KINECT_COMP == 1
    void CAnimation::show_kinect(const int& type_anim, const bool& orientation, const int& step, const float& deep) {
     
       if(seq)
     
          // we show the surface with id = cursor
          Vimages.at(seq[cursor])->show_GL_kinect(orientation, object_properties(), deep, slide_blk);
     
       else
     
          // we show the surface with a normal seq (1, 2, 3, 4, 5, ...)
          Vimages.at(cursor)->show_GL_kinect(orientation, object_properties(), deep, slide_blk);
     
       // increment animation
       pass(type_anim, step);
    }
    #endif
    C'est depuis que j'ai rajouté ce #if KINECT_COMP == 1 que ça a du mal à passer. Je compile avec KINECT_COMP valant 1. Les autres classes faisant appel à show_kinect passent bien, sauf ce screen_wait, trop bizarre ! Merci d'avance ça fait 2 h que suis dessus.

  2. #2
    Inactif  


    Homme Profil pro
    Inscrit en
    Novembre 2008
    Messages
    5 288
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 48
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Secteur : Santé

    Informations forums :
    Inscription : Novembre 2008
    Messages : 5 288
    Points : 15 620
    Points
    15 620
    Par défaut
    Salut
    A priori, rien vu de particulier dans ton code. Faudrait donner les fichiers complets

  3. #3
    Expert éminent sénior

    Avatar de dragonjoker59
    Homme Profil pro
    Software Developer
    Inscrit en
    Juin 2005
    Messages
    2 031
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 42
    Localisation : France, Bas Rhin (Alsace)

    Informations professionnelles :
    Activité : Software Developer
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2005
    Messages : 2 031
    Points : 11 379
    Points
    11 379
    Billets dans le blog
    10
    Par défaut
    tu peux pour être sur faire le test d'encadrer ton appel a show_kinect par #if KINECT_COMP == 1 ? (dans screen_wait)
    Si vous ne trouvez plus rien, cherchez autre chose...

    Vous trouverez ici des tutoriels OpenGL moderne.
    Mon moteur 3D: Castor 3D, presque utilisable (venez participer, il y a de la place)!
    Un projet qui ne sert à rien, mais qu'il est joli (des fois) : ProceduralGenerator (Génération procédurale d'images, et post-processing).

  4. #4
    Membre du Club
    Profil pro
    Inscrit en
    Septembre 2009
    Messages
    64
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2009
    Messages : 64
    Points : 40
    Points
    40
    Par défaut oui
    J'ai déjà testé d'encadrer le show_kinect de screen_wait.cpp, mais ça fait toujours la même erreur.

    screen_wait.h
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    #include "animation.h"
    #include "tuxworld.h"
    #include "macros.h"
    #include "exit_game.h"
    #include "../kinect/kinect_button.h"
     
    void screen_wait(s_game &game, SDL_Event &event, bool box_end, std::string& screen_name, const float& time_sb, const int& wait, const bool& show_bk);
    screen_wait.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
    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
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    #include "screen_wait.h"
     
    using namespace std;
     
    void screen_wait(s_game &game, SDL_Event &event, bool box_end, string& screen_name, const float& time_sb, const int& wait, const bool& show_bk) {
     
       unsigned ready = 40;
     
       // draw next icon
       game.anim_next = new CAnimation(false, 0, 1, seq_static_img, 1, IMG_PATH + string("next/next_"), origins, game.coef_resol);
     
       // draw game over
       game.anim_screen_wait = new CAnimation(false, 0, 1, seq_static_img, 1, screen_name.c_str(), origins, game.coef_resol);
     
       // draw cursor hand
       CAnimation hand_cursor = CAnimation(false, 0, 1, seq_static_img, 1, IMG_PATH + string("kinect/hand_cursor_"), origins, game.coef_resol);
     
       unsigned i;
     
       #if KINECT_COMP==1
     
          // squeleton coords
          Ssqueleton skl;
     
          // build two stars buttons
          CKinect_button kin_button(game.coef_resol);
     
       #endif
     
       bool stage_screen = true;
     
       for(wait == 2 ? i = 1: i = 0; i < 2;) {
       //for(i = 0; i < 2;) {
     
     
          if(stage_screen)
             stage_screen = game.anim_screen_wait->slide_black(time_sb);
    /*
          if(wait_game > 60) {
     
             // draw the box "play again"
             if(box_end) {
                SDL_Rect rect_box = {100, 100};
                CBox box_continue(rect_box, .4, game.coef_resol);
                vector<string> vect_play_again;
                vect_play_again.push_back(string("Play again ?"));
                if(box_continue.show(vect_play_again, event, YES_NO).button == NO)
                   exit_game(game);
             }
          }
    */
     
             // show the screen with a slide black alpha
     
             game.anim_screen_wait->show(false, false, 1, .2);
     
             if(!stage_screen && i == 0) {
                game.anim_next->object_move((game.screen->w / 2) / game.coef_resol, (game.screen->h - 64) / game.coef_resol);
     
                game.anim_next->show(NO_LOOP, false, 1, .3);
    	     }
     
             #if KINECT_COMP == 1
     
             if(game.kinect)
             if(show_bk) {
     
                // we lock the thread
                data_kinect.th->lock();
     
                // recover the squeleton
                skl = data_kinect.squel;
     
                // unlock the thread
                data_kinect.th->unlock();
     
                // draw the hand_cursor
                glPushMatrix();
                glTranslatef((SIZE_TEXTURE_W_MAX / 2 - CAM_W / 2) * game.coef_resol, (SIZE_TEXTURE_H_MAX / 2 - CAM_H / 2) * game.coef_resol, 0);
                hand_cursor.object_move(skl.hand0.x, skl.hand0.y);
                #if KINECT_COMP == 1
                hand_cursor.show_kinect(NO_LOOP, false, 1, .4f);
                #endif
     
                glPopMatrix();
     
                // draw stars buttons
                kin_button.draw(SIZE_TEXTURE_W_MAX / 2 - CAM_W / 2, SIZE_TEXTURE_H_MAX / 2 - CAM_H / 2 + CAM_H - 100, -.3);
                // test hands on stars button
                if(kin_button.select(SIZE_TEXTURE_W_MAX / 2 - CAM_W / 2 + skl.hand0.x, SIZE_TEXTURE_H_MAX / 2 - CAM_H / 2 + skl.hand0.y))
                   --ready;
                else
                   ready = 40;
     
                if(!ready && !stage_screen) {
                   stage_screen = true;
                   ++i;
                }
             }
     
             #endif
     
             SDL_Delay(TimeLeft());
     
     
             // to read the story, we press a button to continue
     
             if((!stage_screen && !wait) || (!stage_screen && i == 1)) {
                stage_screen = true;
                ++i;
     
             }
     
             // update screen
             glFlush();
             SDL_GL_SwapBuffers();
     
     
             while(SDL_PollEvent(&event)) {
                if(!stage_screen)
                   if(event.type == SDL_KEYDOWN || event.type == SDL_MOUSEBUTTONDOWN || event.type == SDL_JOYBUTTONDOWN) {
                      stage_screen = true;
                      ++i;
                   }
     
                   if(event.type == SDL_QUIT)
                      exit_game(game);
             }
          }
     
       delete game.anim_screen_wait;
    }
    animation.h
    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
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    #ifndef ANIMATION
    #define ANIMATION
     
    #include <string>
    #include <vector>
    #include <memory>
     
    #include "vector2d.h"
    #include "graphic.h"
    #include "converter.h"
    #include "draw.h"
    #include "sequence.h"
     
    // how we expose images
    enum {
       NO_LOOP,
       LOOP,
       UP_DOWN_LOOP
    };
     
    class CAnimation : public CGraphic
    {
     
       private :
          // list of indexes images
          const char *seq;
          // nbr_seq : number of indexes in the sequence
          const int nbr_seq;
          // offset : to begin on image[offset]
          const int offset;
          // current position in sequence
          int cursor;
          // list of images
          std::vector< std::shared_ptr<CDraw> > Vimages;
          // false : increment animation, true : decrement
          bool up_down;
          // to slide image alpha up, down and stop
          int slide_up;
          // black alpha color
          Color4f slide_blk;
     
       public :
          // orientation : true return images on Y axis with PI angle
          // nbr_images : number of images
          // file : name of file without id
          // coord : animation locate
          // coef_resol : resolution game between 1 = full resolution
          CAnimation(const bool& orientation_, const int& offset_, const int& nbr_images_, const char *seq_, const int& nbr_seq_, const std::string& file_, const SDL_Rect& coord_, const float& coef_resol_);
          //destructor
          ~CAnimation();
     
          // loop_type : see enum with LOOP, NO_LOOP and UP_DOWN_LOOP
          // step : for a quick or slow animation
          // deep : put animation on Z axis
          // scale : sclae images
     
          // animate without showing
          void pass(const int& loop_type, const int& step);
          // show without scale
          void show(const int& loop_type, const bool& orientation, const int& step, const float& deep);
     
          #if KINECT_COMP == 1
          // show without scale for kinect
          void show_kinect(const int& loop_type, const bool& orientation, const int& step, const float& deep);
          #endif
     
          // show with scale
          void show(const int& loop_type, const bool& orientation, const int& step, const TVector2d<float>& scale, const float& rotation, const float& deep);
          // to show with a slide black alpha, return false when is not finished increasing
          bool slide_black(float speed);
    };
     
    inline void CAnimation::pass(const int& loop_type, const int& step) {
     
       // we go to the next image
       up_down ? cursor -= step : cursor += step;
     
       if(cursor <= 0) {
             // go up animation
             cursor = 0;
             up_down = false;
       }
     
       if(cursor >= nbr_seq)
          switch(loop_type) {
     
             case LOOP :
                // restart animation
                cursor = 0;
             break;
     
             case UP_DOWN_LOOP :
                // go down animation
                cursor = nbr_seq - 1;
                up_down = true;
             break;
     
             case NO_LOOP :
                // we stop at the end of sequence
                cursor = nbr_seq - 1;
             break;
     
             default :
             break;
          }
    }
     
    #endif
    animation.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
    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
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    #include "animation.h"
     
    using namespace std;
     
    CAnimation::CAnimation(const bool& orientation_, const int& offset_, const int& nbr_images_, const char *seq_, const int& nbr_seq_, const string& file_, const SDL_Rect& coord_, const float& coef_resol_) : CGraphic(coord_, coef_resol_), up_down(false), slide_up(0), seq(seq_), nbr_seq(nbr_seq_), offset(offset_), cursor(0) { 
     
       // name file completed with sufix like name3.png
       string complet_file;
     
       // to convert int to string
       CConverter conv;
     
       // init slide image alpha
       slide_blk = {1.0f, 1.0f, 1.0f, 1.0f};
     
       try { 
     
          for(int i = offset; i < offset + nbr_images_; ++i) {
     
             // we create a complet file like name to name12.png
             complet_file = file_ + (conv << (i + 1)) + ".png";
     
             // we create list with images
             shared_ptr<CDraw> draw = make_shared<CDraw>(complet_file.c_str(), coord_, coef_resol);
     
             // only texture is saved, not surface because we don't use tests on surface
             draw->Free_surface();
     
             // We reverse picture on Y axis
             if(orientation_)
                draw->reverse_H_SDL();
     
             // Push image in the vector
             Vimages.push_back(draw);
     
          }
       }
       catch(string &caught) {
     
          Vimages.clear();
          cerr << caught << endl;
          throw;
     
       }
     
       // we update width and height animation values
       set_object_properties(Vimages.at(0)->object_properties());
     
    }
     
    CAnimation::~CAnimation() {
     
          Vimages.clear();	   
     
    }
     
    bool CAnimation::slide_black(float speed) {
     
       // init slide_black to start
       if(slide_up == 0 && slide_blk.r == 1.0)
          slide_blk = {.0f, .0f, .0f, 1.0f};
     
       // increment up the grey color
       if(!slide_up) {
          slide_blk.r += speed;
          slide_blk.g += speed;
          slide_blk.b += speed;
       }
     
       // increment down the grey color
       if(slide_up == 1) {
          slide_blk.r -= speed;
          slide_blk.g -= speed;
          slide_blk.b -= speed;
       }
     
       // to increase down
       if(slide_blk.r >= 1.0f) {
          slide_up = 1;
          return false;
       }
     
       // to increase up
       if(slide_blk.r <= .0f) {
          slide_up = 2;
          return false;
       }
     
       return true;
    }
     
    void CAnimation::show(const int& type_anim, const bool& orientation, const int& step, const float& deep) {
     
       if(seq)
     
          // we show the surface with id = cursor
          Vimages.at(seq[cursor])->show_GL(orientation, object_properties(), deep, slide_blk);
     
       else
     
          // we show the surface with a normal seq (1, 2, 3, 4, 5, ...)
          Vimages.at(cursor)->show_GL(orientation, object_properties(), deep, slide_blk);
     
       // increment animation
       pass(type_anim, step);
    }
     
    #if KINECT_COMP == 1
    void CAnimation::show_kinect(const int& type_anim, const bool& orientation, const int& step, const float& deep) {
     
       if(seq)
     
          // we show the surface with id = cursor
          Vimages.at(seq[cursor])->show_GL_kinect(orientation, object_properties(), deep, slide_blk);
     
       else
     
          // we show the surface with a normal seq (1, 2, 3, 4, 5, ...)
          Vimages.at(cursor)->show_GL_kinect(orientation, object_properties(), deep, slide_blk);
     
       // increment animation
       pass(type_anim, step);
    }
    #endif
     
    void CAnimation::show(const int& loop_type, const bool& orientation, const int& step, const TVector2d<float>& scale, const float& rotation, const float& deep) {
     
       if(seq)
     
          // we show the surface with id = cursor
          Vimages.at(seq[cursor])->show_GL(orientation, object_properties(), scale, rotation, deep);
     
       else
     
          // we show the surface with a normal seq (1, 2, 3, 4, 5, ...)
          Vimages.at(cursor)->show_GL(orientation, object_properties(), scale, rotation, deep);
     
       // increment animation
       pass(loop_type, step);
    }

Discussions similaires

  1. Erreur de compilation après modification du Uses
    Par DevelOpeR13 dans le forum Langage
    Réponses: 5
    Dernier message: 30/10/2007, 14h23
  2. Réponses: 2
    Dernier message: 23/09/2003, 14h32
  3. Réponses: 10
    Dernier message: 22/09/2003, 21h58
  4. Réponses: 4
    Dernier message: 27/08/2003, 21h34
  5. Réponses: 2
    Dernier message: 04/03/2003, 23h24

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