gpt4 book ai didi

c++ - 在 Xcode 6.3 中使用 Boost C++?

转载 作者:行者123 更新时间:2023-11-28 06:11:53 24 4
gpt4 key购买 nike

Undefined symbols for architecture x86_64:
"boost::serialization::typeid_system::extended_type_info_typeid_0::type_register (std::type_info const&)", referenced from:
boost::serialization::extended_type_info_typeid<std::__1::pair<long long const, long long> >::extended_type_info_typeid() in TestC.o
boost::serialization::extended_type_info_typeid<std::__1::map<long long, long long, std::__1::less<long long>, std::__1::allocator<std::__1::pair<long long const, long long> > > >::extended_type_info_typeid() in TestC.o
"boost::serialization::typeid_system::extended_type_info_typeid_0::type_unregister()", referenced from:
boost::serialization::extended_type_info_typeid<std::__1::pair<long long const, long long> >::~extended_type_info_typeid() in TestC.o
boost::serialization::extended_type_info_typeid<std::__1::map<long long, long long, std::__1::less<long long>, std::__1::allocator<std::__1::pair<long long const, long long> > > >::~extended_type_info_typeid() in TestC.o
"boost::serialization::typeid_system::extended_type_info_typeid_0::extended_type_info_typeid_0(char const*)", referenced from:
boost::serialization::extended_type_info_typeid<std::__1::pair<long long const, long long> >::extended_type_info_typeid() in TestC.o
boost::serialization::extended_type_info_typeid<std::__1::map<long long, long long, std::__1::less<long long>, std::__1::allocator<std::__1::pair<long long const, long long> > > >::extended_type_info_typeid() in TestC.o
"boost::serialization::typeid_system::extended_type_info_typeid_0::~extended_type_info_typeid_0()", referenced from:
boost::serialization::extended_type_info_typeid<std::__1::pair<long long const, long long> >::~extended_type_info_typeid() in TestC.o
boost::serialization::extended_type_info_typeid<std::__1::pair<long long const, long long> >::extended_type_info_typeid() in TestC.o
boost::serialization::extended_type_info_typeid<std::__1::map<long long, long long, std::__1::less<long long>, std::__1::allocator<std::__1::pair<long long const, long long> > > >::~extended_type_info_typeid() in TestC.o
boost::serialization::extended_type_info_typeid<std::__1::map<long long, long long, std::__1::less<long long>, std::__1::allocator<std::__1::pair<long long const, long long> > > >::extended_type_info_typeid() in TestC.o

我将 Boost C++ 库用于我的 objective-c 项目。我按照此说明为 Xcode 添加 boost 功能:
http://freddy.cellcore.org/post/79587278354/boost-c-libraries-on-osx-xcode-5
添加 boost.framework 后,我可以毫无错误地包含 header 。

#include <boost/archive/text_iarchive.hpp> 
#include <boost/archive/text_oarchive.hpp>
#include <boost/serialization/map.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>

但是当我添加如下几行代码时,按构建,它显示上面的错误。

std::map<int64_t, int64_t> foo;
boost::filesystem::path myFile = boost::filesystem::current_path() / "myfile.dat";

if (filesystem::exists(myFile))
{
filesystem::ifstream ifs(myFile/*.native()*/);
archive::text_iarchive ta(ifs);

ta >> foo; // foo is empty until now, it's fed by myFile

std::cout << "Read " << foo.size() << " entries from " << myFile << "\n";
} else {
for (int i=0; i<100; ++i) foo[i] = 10;
filesystem::ofstream ofs(myFile/*.native()*/);
archive::text_oarchive ta(ofs);

ta << foo; // foo is empty until now, it's fed by myFile
std::cout << "Wrote " << foo.size() << " random entries to " << myFile << "\n";
}

我该如何解决这个问题?

最佳答案

我无法再访问该 Github 页面,但我猜你只有 x86 版本,没有 x64 版本。

Try this...

来自脚本:

# To configure the script, define:
# BOOST_LIBS: which libraries to build
# IPHONE_SDKVERSION: iPhone SDK version (e.g. 5.1)
#
# Then go get the source tar.bz of the boost you want to build, shove it in the
# same directory as this script, and run "./boost.sh".

或者您可以试试这个版本?它是预编译的... https://github.com/danoli3/ofxiOSBoost

关于c++ - 在 Xcode 6.3 中使用 Boost C++?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31110866/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com