美文网首页BUG整理
解决symbol(s) not found for archit

解决symbol(s) not found for archit

作者: 最慢的是活着 | 来源:发表于2018-12-24 16:17 被阅读17次

今天在写一个小说阅读器时遇到一个错误。

Undefined symbols for architecture x86_64:
  "_xmlDocDumpMemory", referenced from:
      -[CXMLDocument XMLDataWithOptions:] in CXMLDocument.o
  "_xmlDocGetRootElement", referenced from:
      -[CXMLDocument initWithData:encoding:options:error:] in CXMLDocument.o
      -[CXMLDocument rootElement] in CXMLDocument.o
  "_xmlDocDumpFormatMemory", referenced from:
      -[CXMLDocument description] in CXMLDocument.o
  "_htmlReadMemory", referenced from:
      -[CXHTMLDocument initWithXHTMLData:encoding:options:error:] in CXHTMLDocument.o
  "_xmlGetCharEncodingName", referenced from:
      -[CXHTMLDocument initWithXHTMLString:options:error:] in CXHTMLDocument.o
  "_htmlParseDoc", referenced from:
      -[CXHTMLDocument initWithXHTMLString:options:error:] in CXHTMLDocument.o
  "_xmlGetLastError", referenced from:
      -[CXHTMLDocument initWithXHTMLString:options:error:] in CXHTMLDocument.o
      -[CXMLDocument initWithXMLString:options:error:] in CXMLDocument.o
      -[CXMLDocument initWithData:encoding:options:error:] in CXMLDocument.o
  "_xmlResetLastError", referenced from:
      -[CXHTMLDocument initWithXHTMLString:options:error:] in CXHTMLDocument.o
      -[CXMLDocument initWithXMLString:options:error:] in CXMLDocument.o
      -[CXMLDocument initWithData:encoding:options:error:] in CXMLDocument.o
  "_xmlXPathRegisterNs", referenced from:
      -[CXMLNode(CXMLNode_XPathExtensions) nodesForXPath:namespaceMappings:error:] in CXMLNode_XPathExtensions.o
  "_xmlFree", referenced from:
      -[CXMLDocument XMLDataWithOptions:] in CXMLDocument.o
      -[CXMLDocument description] in CXMLDocument.o
  "_xmlFreeDoc", referenced from:
      -[CXMLDocument dealloc] in CXMLDocument.o
  "_xmlNodeSetContent", referenced from:
      -[CXMLNode(CXMLNode_CreationExtensions) setStringValue:] in CXMLNode_CreationExtensions.o
  "_xmlNewNs", referenced from:
      +[CXMLNode(CXMLNode_CreationExtensions) elementWithName:URI:] in CXMLNode_CreationExtensions.o
  "_xmlParseDoc", referenced from:
      -[CXMLDocument initWithXMLString:options:error:] in CXMLDocument.o
  "_xmlNewDoc", referenced from:
      +[CXMLNode(CXMLNode_CreationExtensions) document] in CXMLNode_CreationExtensions.o
      +[CXMLNode(CXMLNode_CreationExtensions) documentWithRootElement:] in CXMLNode_CreationExtensions.o
  "_xmlXPathEvalExpression", referenced from:
      -[CXMLNode nodesForXPath:error:] in CXMLNode.o
      -[CXHTMLDocument initWithXHTMLString:options:error:] in CXHTMLDocument.o
      -[CXMLNode(CXMLNode_XPathExtensions) nodesForXPath:namespaceMappings:error:] in CXMLNode_XPathExtensions.o
  "_xmlUnlinkNode", referenced from:
      -[CXMLNode(CXMLNode_PrivateExtensions) invalidate] in CXMLNode_PrivateExtensions.o
      -[CXMLDocument dealloc] in CXMLDocument.o
  "_xmlXPathNewContext", referenced from:
      -[CXMLNode nodesForXPath:error:] in CXMLNode.o
      -[CXHTMLDocument initWithXHTMLString:options:error:] in CXHTMLDocument.o
      -[CXMLNode(CXMLNode_XPathExtensions) nodesForXPath:namespaceMappings:error:] in CXMLNode_XPathExtensions.o
  "_xmlNewNode", referenced from:
      +[CXMLNode(CXMLNode_CreationExtensions) elementWithName:] in CXMLNode_CreationExtensions.o
      +[CXMLNode(CXMLNode_CreationExtensions) elementWithName:URI:] in CXMLNode_CreationExtensions.o
      +[CXMLNode(CXMLNode_CreationExtensions) elementWithName:stringValue:] in CXMLNode_CreationExtensions.o
  "_xmlFreeNode", referenced from:
      -[CXMLNode(CXMLNode_PrivateExtensions) invalidate] in CXMLNode_PrivateExtensions.o
  "_xmlCopyNode", referenced from:
      -[CXMLNode copyWithZone:] in CXMLNode.o
  "_xmlXPathFreeObject", referenced from:
      -[CXMLNode nodesForXPath:error:] in CXMLNode.o
      -[CXHTMLDocument initWithXHTMLString:options:error:] in CXHTMLDocument.o
      -[CXMLNode(CXMLNode_XPathExtensions) nodesForXPath:namespaceMappings:error:] in CXMLNode_XPathExtensions.o
  "_xmlNodeDumpOutput", referenced from:
      -[CXMLNode XMLStringWithOptions:] in CXMLNode.o
  "_xmlNewText", referenced from:
      -[CXMLElement(CXMLElement_CreationExtensions) setStringValue:] in CXMLElement_CreationExtensions.o
  "_xmlXPathFreeContext", referenced from:
      -[CXMLNode nodesForXPath:error:] in CXMLNode.o
      -[CXHTMLDocument initWithXHTMLString:options:error:] in CXHTMLDocument.o
      -[CXMLNode(CXMLNode_XPathExtensions) nodesForXPath:namespaceMappings:error:] in CXMLNode_XPathExtensions.o
  "_xmlOutputBufferClose", referenced from:
      -[CXMLNode XMLStringWithOptions:] in CXMLNode.o
  "_xmlReadMemory", referenced from:
      -[CXMLDocument initWithData:encoding:options:error:] in CXMLDocument.o
  "_xmlOutputBufferCreateIO", referenced from:
      -[CXMLNode XMLStringWithOptions:] in CXMLNode.o
  "_xmlAddChild", referenced from:
      -[CXMLElement(CXMLElement_CreationExtensions) addChild:] in CXMLElement_CreationExtensions.o
      -[CXMLElement(CXMLElement_CreationExtensions) setStringValue:] in CXMLElement_CreationExtensions.o
      -[CXMLDocument(CXMLDocument_CreationExtensions) addChild:] in CXMLDocument_CreationExtensions.o
  "_xmlAddPrevSibling", referenced from:
      -[CXMLDocument(CXMLDocument_CreationExtensions) insertChild:atIndex:] in CXMLDocument_CreationExtensions.o
  "_xmlOutputBufferFlush", referenced from:
      -[CXMLNode XMLStringWithOptions:] in CXMLNode.o
  "_xmlNewPI", referenced from:
      +[CXMLNode(CXMLNode_CreationExtensions) processingInstructionWithName:stringValue:] in CXMLNode_CreationExtensions.o
  "_xmlDocSetRootElement", referenced from:
      +[CXMLNode(CXMLNode_CreationExtensions) documentWithRootElement:] in CXMLNode_CreationExtensions.o
      -[CXHTMLDocument initWithXHTMLString:options:error:] in CXHTMLDocument.o
  "_xmlSetNs", referenced from:
      -[CXMLElement(CXMLElement_CreationExtensions) addNamespace:] in CXMLElement_CreationExtensions.o
  "_xmlStrcmp", referenced from:
      -[CXMLElement elementsForName:] in CXMLElement.o
      -[CXMLElement elementsForLocalName:URI:] in CXMLElement.o
      -[CXMLElement attributeForName:] in CXMLElement.o
      -[CXMLElement attributeForLocalName:URI:] in CXMLElement.o
      -[CXMLElement namespaceForPrefix:] in CXMLElement.o
      -[CXMLElement resolvePrefixForNamespaceURI:] in CXMLElement.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

查看代码基本上确定了是由于部分依赖的框架没有导入。
仔细看下报错的内容,错误指向 CXMLDocument.o,于是我到对应的.m文件里面,发现它引用了系统的框架。


屏幕快照 2018-12-24 下午4.13.38.png 于是尝试手动导入这个框架: ![屏幕快照 2018-12-24 下午4.13.38.png](https://img.haomeiwen.com/i1828389/784b05ab7708fcdb.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

运行成功,如果这个解决以后发现还有相似的错误指向不同的文件,可用同样的方法进行排除。

错误做个备份,以免下次再遇到。

相关文章

网友评论

    本文标题:解决symbol(s) not found for archit

    本文链接:https://www.haomeiwen.com/subject/auuzkqtx.html