0

I want to test the following function with std::async for a static class and my main aim is to wait untill the function executes. But i am facing the following error. Can some one give me a reason for this error.

IASD* ASDInterface = getASD();//gets the instance corrcet and tested function successfully

auto habnd = std::async(std::launch::async, &IASD::handle_request, ASDInterface ,arb_id, sid, data, size);

after debug the above line i am getting following error.

error LNK2019: unresolved external symbol __imp___CrtDbgReportW referenced in function "protected: __thiscall Concurrency::details::_RefCounter::_RefCounter(long)" (??0_RefCounter@details@Concurrency@@IAE@J@Z)

can some one answer me why i am getting above error.

Thank you so much.

Galik
  • 47,303
  • 4
  • 80
  • 117
  • If you want to run function async maybe try with http://www.tutorialspoint.com/cplusplus/cpp_multithreading.htm – ventaquil Nov 12 '15 at 12:53
  • I can't help you if you don't provide any code that gives this error. Show us some code! "read it tutorial" is the best answer right now. – Lukáš Bednařík Nov 12 '15 at 13:00

1 Answers1

1

I don't think it's releted to the std::async directly,
I suspect there's a mismatch on the Runtime option on the Code Generation tab

make sure that on degub build, the "Runtime Library" is set on "Multy-threaded debug /MTd" or "Multi-thread Debug DLL /MDd"
(Project -> properties -> Configuration Properties -> C/C++ -> Code Generation -> Runtime Library)

David Haim
  • 25,446
  • 3
  • 44
  • 78