Fix "Undefined symbols" linker error when DocumentChange::npos was used by dconeybe · Pull Request #474 · firebase/firebase-cpp-sdk
Fix a bug where accessing firebase::firestore::DocumentChange::npos from a non-Android platform results in a linker error:
Undefined symbols for architecture x86_64:
"firebase::firestore::DocumentChange::npos", referenced from:
firebase_testapp_automated::FirebaseFirestoreBasicTest_TestDocumentChangeNpos_Test::TestBody() in integration_test.cc.o
ld: symbol(s) not found for architecture x86_64
Here is the declaration of npos:
| #if defined(ANDROID) | |
| // Older NDK (r16b) fails to define this properly. Fix this when support for | |
| // the older NDK is removed. | |
| static const std::size_t npos; | |
| #else | |
| static constexpr std::size_t npos = static_cast<std::size_t>(-1); | |
| #endif // defined(ANDROID) |
The fix is to add a definition of npos into the corresponding .cc file