0 Members and 2 Guests are viewing this topic.
error: no matching function for call to 'sf::Thread::Thread(void (Foo::*)(void*))'|
#include <SFML/System.hpp>#include <iostream>#include "Foo.h"int main(){ // Create a thread with our function // Start it ! Foo bar; bar.init(); // Print something... for (int i = 0; i < 10; ++i) std::cout << "I'm the main thread" << std::endl; return EXIT_SUCCESS;}
#ifndef FOO#define FOO#include <SFML/Graphics.hpp>#include <SFML/Window.hpp>#include <SFML/System.hpp>class Foo{ public: void ThreadFunction(void*); void init();};#endif
#include <SFML/Graphics.hpp>#include <SFML/Window.hpp>#include <SFML/System.hpp>#include <iostream>#include "Foo.h"void Foo::ThreadFunction(void* UserData){ // Print something... for (int i = 0; i < 10; ++i) std::cout << "I'm the thread number 1" << std::endl;}void Foo::init(){ sf::Thread Thread(&ThreadFunction); //Tried these as well, did not work //sf::Thread Thread(&Foo::ThreadFunction); //sf::Thread Thread(ThreadFunction()); Thread.Launch();}