我不能用C++编译Xcode库

I can not compile the Xcode library with C++

本文关键字:Xcode 编译 C++ 不能      更新时间:2023-10-16

问题是,我需要用之前在windows中编译的macos上的makefile编译库,该库在Ubuntu上进行了测试(在那里,它与macos(编译(形成了对比(当我将makefile添加到xcodeporject并尝试构建该项目时,我得到了这个错误Xcode构建

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

这是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)

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