undefined reference to


https://github.com/NativeScript/android-v8/issues/20

nm -gAC libv8.a | grep "v8::platform::NewDefaultPlatform"

libv8.a:default-platform.o:0000000000000000 T v8::platform::NewDefaultPlatform(int, v8::platform::IdleTaskSupport, v8::platform::InProcessStackDumping, std::__Cr::unique_ptr >)

err

/usr/bin/ld: ./so/libv8a1.so: undefined reference to `v8::platform::NewDefaultPlatform(int, v8::platform::IdleTaskSupport, v8::platform::InProcessStackDumping, std::unique_ptr >)'

You can try searching the exported symbols from the static library using :nm

nm -gAC libv8.a | grep "v8::platform::NewDefaultPlatform"
通常,您应该看到以下输出:

libv8.a:default-platform.o:0000000000000000 T v8::platform::NewDefaultPlatform(int, v8::platform::IdleTaskSupport, v8::platform::InProcessStackDumping, std::__Cr::unique_ptr)
如您所见,此版本中使用了一些不同的命名空间:

std::__Cr::unique_ptr
而不是

std::__ndkCr::unique_ptr
错误消息似乎表明您没有在 v8 生成期间使用的项目中使用自定义 libc++。因此,请确保针对此自定义 STL 进行链接,以便成功编译。你可以看看这是如何在android运行时CMakeLists中实现的.txt