android / codelab-android-wavemaker

Sample app which accompanies the "Making Waves" codelab - Part 1 Build a Synthesizer
https://codelabs.developers.google.com/codelabs/making-waves-1-synth
Apache License 2.0
42 stars 24 forks source link

std::_bind is not compatible with std::function #7

Open SmartyNance opened 6 years ago

SmartyNance commented 6 years ago

if (error == AAUDIO_ERROR_DISCONNECTED){ std::function<void(void)>

restartFunction = std::bind(&AudioEngine::restart, static_cast<AudioEngine *>(userData));

        new std::thread(restartFunction);
}

Went over the whole file multiple times, and I can't find any difference from what is in your tutorial, but the block of text in the middle always shows an error

dturner commented 6 years ago

Thanks very much for filing this issue - and sorry that you ran into it. I believe something changed in the NDK which means that you now need to explicitly link against libandroid which can be done within CMakeLists.txt by adding android to the list of target_link_libraries

dturner commented 6 years ago

I thought that was the problem but having now removed libandroid from the list of libraries the app still compiles. Please could you post the compilation error you're receiving. I'll try cloning from scratch to see if I can reproduce.

SmartyNance commented 6 years ago

Thanks for getting back to me! It’s “Class ‘std::_bind<void(AudioEngine::)(),AudioEngine>’ is not compatible with class ‘std::function <void()>”