Greetings,
I was trying to create a class in a separate header. As soon as the constructor for the class would be called, a thread inside that class would run. However, declaring a sf::Thread in a class gives some issues. So I tried to search the web and I found this forum thread:
http://en.sfml-dev.org/forums/index.php?topic=7906.msg52768#msg52768. I attempted what was suggested in this thread:
#include <SFML\System.hpp>
#include <iostream>
class test_class{
private:
test_class():test_thread(&test_class::loop, this){}
int *a_p;
sf::Thread test_thread;
public:
test_class::test_class(int& a){
a_p = &a;
}
void loop(){
while(*a_p < 50){
std::cout << *a_p << std::endl;
}
}
};
However, sf::Thread has no default constructor, so I got the following error:
]
1>c:\users\frank\documents\visual studio 2010\projects\cppapplication_4\test.h(9): error C2512: 'sf::Thread' : no appropriate default constructor availableI'm sort of confused what to do next
Any help will be appreciated.