1

I use std::thread in my C++ class in my Visual Studio 2015 project.

class BaggageSoln { void mainProcess(); // Threading functions void run(); void startZED(); void closeZED(); private: std::thread zed_callback; } void BaggageSoln::startZED() { // Start the thread for grabbing ZED data has_data = false; zed_callback = std::thread(&BaggageSoln::run); //Wait for data to be grabbed while (!has_data) sleep_ms(1); } void BaggageSoln::mainProcess() {} void BaggageSoln::run() {} void BaggageSoln::closeZED(){} 

Error is happening at xthread file at line 238. What could be wrong?

0

1 Answer 1

3

&BaggageSoln::run requires an instance to be called, make it static or provide an instance.

zed_callback = std::thread(&BaggageSoln::run, this); 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.