Search code examples
c++asynchronousvisual-studio-2013stdasync

error in async function


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.


Solution

  • 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)