Invalide conversion

Résolu
VULCHOK Messages postés 30 Date d'inscription vendredi 8 décembre 2000 Statut Membre Dernière intervention 15 juillet 2012 - 15 juil. 2012 à 19:23
BunoCS Messages postés 15475 Date d'inscription lundi 11 juillet 2005 Statut Modérateur Dernière intervention 23 avril 2024 - 16 juil. 2012 à 11:45
Bonjours a tout le monde,

Voila un souci sur leque je planche depuis plusieurs heures et dont je ne trouve aucune solution

Voici l'erreur :

src/Core.cpp: In member function ‘void LSC::Core::run()’:
src/Core.cpp:94:60: erreur: no matching function for call to ‘LSC::Thread::start(void* (LSC::Core::*)(void*), void*)’
src/Core.cpp:94:60: note: candidate is:
include/Thread.hpp:26:18: note: virtual void LSC::Thread::start(void* (*)(void*), void*)
include/Thread.hpp:26:18: note: no known conversion for argument 1 from ‘void* (LSC::Core::*)(void*)’ to ‘void* (*)(void*)’

Les deux fichier en questions :
#include	

#include	"Core.hpp"
#include	"Thread.hpp"
#include	"IElement.hpp"


namespace	LSC
{
  Core			*Core::instance_ = NULL;

  Core			*Core::instance(void)
  {
    if (!instance_)
      instance_ = new Core();
    return (instance_);
  }

  void		Core::addOnScreen(IElement *Object)
  {
    this->onScreen_.push_back(Object);
  }

  int		Core::delFromScreen(IElement *Object)
  {
    this->onScreen_.remove(Object);
    return (0);
  }

  void		Core::initClass(void)
  {
    std::list::iterator itb = this->onScreen_.begin();
    while (itb != this->onScreen_.end())
      {
(*itb)->initClass();
itb++;
      }
  }

  void		Core::update(void *Object)
  {
    while(this->status)
      {
if (pthread_mutex_trylock(&(this->m_update)) == 0)
  {
    std::list::iterator itb = this->onScreen_.begin();

    while (itb != this->onScreen_.end())
      {
(*itb)->update();
itb++;
      }
  }
      }
  }

  void*		Core::display(void *Object)
  {
    while(this->status)
      {
if (pthread_mutex_trylock(&(this->m_display)) == 0)
  {
    std::list::iterator itb = this->onScreen_.begin();

    this->window_.clearWindow();
    if (event.type == sf::Event::Resized)
      glViewport(0, 0, event.size.width, event.size.height);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    while (itb != this->onScreen_.end())
      {
(*itb)->display();
this->window_.displayWindow();
itb++;
      }
  }
      }
    return (NULL);
  }

  void		Core::run(void)
  {
    Thread		*thread = new Thread();

    status = true;
    thread->start(&Core::display, static_cast<void *>(this));
    while (this->status)
      {
usleep(2000);
pthread_mutex_unlock(&(this->m_display));
pthread_mutex_unlock(&(this->m_update));
      }
  }

  void		Core::stop(void)
  {
    this->status = false;
  }

  Core::Core()
  {}
  Core::~Core()
  {}
}



#include	

#include	"Core.hpp"
#include	"Thread.hpp"
#include	"IElement.hpp"


namespace	LSC
{
  Core			*Core::instance_ = NULL;

  Core			*Core::instance(void)
  {
    if (!instance_)
      instance_ = new Core();
    return (instance_);
  }

  void		Core::addOnScreen(IElement *Object)
  {
    this->onScreen_.push_back(Object);
  }

  int		Core::delFromScreen(IElement *Object)
  {
    this->onScreen_.remove(Object);
    return (0);
  }

  void		Core::initClass(void)
  {
    std::list::iterator itb = this->onScreen_.begin();
    while (itb != this->onScreen_.end())
      {
(*itb)->initClass();
itb++;
      }
  }

  void		Core::update(void *Object)
  {
    while(this->status)
      {
if (pthread_mutex_trylock(&(this->m_update)) == 0)
  {
    std::list::iterator itb = this->onScreen_.begin();

    while (itb != this->onScreen_.end())
      {
(*itb)->update();
itb++;
      }
  }
      }
  }

  void*		Core::display(void *Object)
  {
    while(this->status)
      {
if (pthread_mutex_trylock(&(this->m_display)) == 0)
  {
    std::list::iterator itb = this->onScreen_.begin();

    this->window_.clearWindow();
    if (event.type == sf::Event::Resized)
      glViewport(0, 0, event.size.width, event.size.height);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    while (itb != this->onScreen_.end())
      {
(*itb)->display();
this->window_.displayWindow();
itb++;
      }
  }
      }
    return (NULL);
  }

  void		Core::run(void)
  {
    Thread		*thread = new Thread();

    status = true;
    thread->start(&Core::display, static_cast<void *>(this));
    while (this->status)
      {
usleep(2000);
pthread_mutex_unlock(&(this->m_display));
pthread_mutex_unlock(&(this->m_update));
      }
  }

  void		Core::stop(void)
  {
    this->status = false;
  }

  Core::Core()
  {}
  Core::~Core()
  {}
}


Une idée de comment régler le souci ?

Merci d'avance
A voir également:

2 réponses

VULCHOK Messages postés 30 Date d'inscription vendredi 8 décembre 2000 Statut Membre Dernière intervention 15 juillet 2012
15 juil. 2012 à 21:00
Le problem venais du faite que ma fonction threader doit être déclarer en static.
3
BunoCS Messages postés 15475 Date d'inscription lundi 11 juillet 2005 Statut Modérateur Dernière intervention 23 avril 2024 103
16 juil. 2012 à 11:45
Hello,
Problème résolé du coup? Merci de cliquer sur "Réponse Acceptée"


@+
Buno, Admin CS
L'urgent est fait, l'impossible est en cours. Pour les miracles, prévoir un délai...
0
Rejoignez-nous