我无法使用C ++编译Xcode库

时间:2018-07-30 13:20:11

标签: c++ xcode makefile cmake linker

问题是我需要在Windows上编译过的macos上使用makefile编译该库,该库已在Ubuntu上进行了测试(与macOS(已编译)形成对比),当我将makefile添加到xcodeporject,并尝试构建此项目,我收到此错误Xcode building

所以我不能用这个makefile在Xcode中建立这个库。 但是如果我在终端的帮助下尝试此操作(具有相同的源文件,相同的目录,相同的make文件) 它正在构建中,我实际上不知道如何运行,但是它可以工作,但是当我开始运行测试时(也在终端中) 它给我这个 test running terminal 我是macOS和makefile编译的新手,idk发生了什么事,请帮忙!

这是Xcode中的错误文本  :Undefined symbols for architecture x86_64: "_main", referenced from: implicit entry/start for main executable "_xmlCheckVersion", referenced from: ADA::GCGxmlIO::OpenImpl(std::__1::basic_istream<char, std::__1::char_traits<char> >*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, ADA::GCGFile&) in GCGxmlIO.o ADA::GCGxmlIO::SaveImpl(ADA::GCGxmlIO::IDeferredOstream*, ADA::GCGFile const&) in GCGxmlIO.o "_xmlDocGetRootElement", referenced from: ADA::GCGxmlIO::OpenImpl(std::__1::basic_istream<char, std::__1::char_traits<char> >*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, ADA::GCGFile&) in GCGxmlIO.o "_xmlFree", referenced from:

和运行测试时的终端错误:    MacBook-Pro-Artem:gcc artem$ g++ -m32 -g -pipe -O3 -DNDEBUG -I../../../src -I/usr/include -I/usr/local/include -o ../../bin/common-wdi/apaEncode.xcodeproj ../../bin/common-wdi/obj/PDFAPI/apaEncode/encode.o ../../../bin/common-wdi/lib/PDFAPI.a ../../../bin/common-wdi/lib/ELib.a -lz

'Undefined symbols for architecture i386:'
APA::PDPage::PAGE_SIZE_LETTER", referenced from:
APA::PDPageTree::NewPage(unsigned long) in PDFAPI.a(PDPageTree.o)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

1 个答案:

答案 0 :(得分:0)

已经解决了,问题出在依赖关系和源代码中