symbol(s) not found for architecture

时间:2019-01-07 13:12:09

标签: xcode unity3d

Hi everyone i get an error, I build my game in xcode from unity

the error start with this:

Undefined symbols for architecture arm64:
  "std::ostream::write(char const*, long)", referenced from:      Pfx::Linker::Detail::InstancesMapping::write(Pfx::Linker::Detail::MappingOStream) const in libiPhone-lib.a(linkerdetailcachemapping.o)

and too much logs i can't paste all

the error end with this:

"std::string::insert(unsigned long, char const*, unsigned long)", referenced from:
      PatchShaderFogGLES(std::string&, std::string&, FogMode, bool) in libiPhone-lib.a(GLSLUtilities.o)
      PatchVertexShaderFogMetal(std::string&, FogMode) in libiPhone-lib.a(ShaderPatchingMetal.o)
      InsertFogVaryingMetal(std::string&, bool) in libiPhone-lib.a(ShaderPatchingMetal.o)
      PatchPixelShaderFogMetal(std::string&) in libiPhone-lib.a(ShaderPatchingMetal.o)
  "std::_Rb_tree_insert_and_rebalance(bool, std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::_Rb_tree_node_base&)", referenced from:
      std::_Rb_tree<std::string, std::pair<std::string const, void (*)()>, std::_Select1st<std::pair<std::string const, void (*)()> >, std::less<std::string>, std::allocator<std::pair<std::string const, void (*)()> > >::_M_insert_unique(std::_Rb_tree_iterator<std::pair<std::string const, void (*)()> >, std::pair<std::string const, void (*)()> const&) in libiPhone-lib.a(InternalCalls.o)
      std::_Rb_tree<std::string, std::pair<std::string const, void (*)()>, std::_Select1st<std::pair<std::string const, void (*)()> >, std::less<std::string>, std::allocator<std::pair<std::string const, void (*)()> > >::_M_insert_unique(std::pair<std::string const, void (*)()> const&) in libiPhone-lib.a(InternalCalls.o)
      std::_Rb_tree<TypeInfo*, std::pair<TypeInfo* const, TypeInfo*>, std::_Select1st<std::pair<TypeInfo* const, TypeInfo*> >, std::less<TypeInfo*>, std::allocator<std::pair<TypeInfo* const, TypeInfo*> > >::_M_insert_unique(std::pair<TypeInfo* const, TypeInfo*> const&) in libiPhone-lib.a(MetadataCache.o)
      std::_Rb_tree<void (*)(), void (*)(), std::_Identity<void (*)()>, std::less<void (*)()>, std::allocator<void (*)()> >::_M_insert_unique(void (* const&)()) in libiPhone-lib.a(RegisterRuntimeInitializeAndCleanup.o)
      std::_Rb_tree<TypeInfo*, TypeInfo*, std::_Identity<TypeInfo*>, std::less<TypeInfo*>, std::allocator<TypeInfo*> >::_M_insert_unique(TypeInfo* const&) in libiPhone-lib.a(MonoType.o)
      std::_Rb_tree<void*, std::pair<void* const, ExternalAllocInfo>, std::_Select1st<std::pair<void* const, ExternalAllocInfo> >, std::less<void*>, stl_allocator<std::pair<void* const, ExternalAllocInfo>, (MemLabelIdentifier)49, 16> >::_M_insert(std::_Rb_tree_node_base*, std::_Rb_tree_node_base*, std::pair<void* const, ExternalAllocInfo> const&) in libiPhone-lib.a(MemoryManager.o)
      std::_Rb_tree<TexturesMetal::MetalSampler, std::pair<TexturesMetal::MetalSampler const, id<MTLSamplerState> __strong>, std::_Select1st<id<MTLSamplerState> __strong>, memcmp_less<TexturesMetal::MetalSampler>, std::allocator<id<MTLSamplerState> __strong> >::_M_insert(std::_Rb_tree_node_base*, std::_Rb_tree_node_base, id<MTLSamplerState> __strong const&) in libiPhone-lib.a(TexturesMetal.o)
      ...
  "std::string::insert(unsigned long, std::string const&, unsigned long, unsigned long)", referenced from:
      PatchShaderFogGLES(std::string&, std::string&, FogMode, bool) in libiPhone-lib.a(GLSLUtilities.o)
      PatchVertexShaderFogMetal(std::string&, FogMode) in libiPhone-lib.a(ShaderPatchingMetal.o)
      PatchPixelShaderFogMetal(std::string&) in libiPhone-lib.a(ShaderPatchingMetal.o)
  "RegisterStaticallyLinkedModuleClasses(ClassRegistrationContext&)", referenced from:
      InvokeRegisterStaticallyLinkedModuleClasses(ClassRegistrationContext&) in UnityClassRegistration.o
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

if you have any suggest thanks. and i tried:

1 add "-ObjC" or "$(inherited)" to "other linker flags"

2 change "c++ standard library" to "libc++(LLVM)"

3 delete "libiconv.2.dylib" and add "libiconv.2.tdb" because"libiconv.2.dylib" not exists in my project

I am using: XCode(10.1) and Unity4.7.0f1

1 个答案:

答案 0 :(得分:0)

弄清楚了。有必要将“ Apple LLCM 6.0-语言-C ++”中的“ C ++标准库”从“编译器默认”更改为“ libstdc ++(GNU C ++标准库)”

(团结论坛) https://answers.unity.com/questions/837103/unity3d-for-ios-a-lot-of-linker-errors-after-upgra.html