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
Afficher la suite