在 Xcode 6.3 中使用 Boost C++?
Use Boost C++ in Xcode 6.3?
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
我的 objective-c 项目使用 Boost C++ 库。我按照此说明将提升添加到 Xcode:
http://freddy.cellcore.org/post/79587278354/boost-c-libraries-on-osx-xcode-5
添加 boost.framework 后,我可以毫无错误地包含 headers。
#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 版本。
来自脚本:
# 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
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
我的 objective-c 项目使用 Boost C++ 库。我按照此说明将提升添加到 Xcode:
http://freddy.cellcore.org/post/79587278354/boost-c-libraries-on-osx-xcode-5
添加 boost.framework 后,我可以毫无错误地包含 headers。
#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 版本。
来自脚本:
# 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