尝试使用Boost.Filesystem的但它似乎没有联系呢? [英] Attempting to use Boost.Filesystem however it doesn't seem to link?
本文介绍了尝试使用Boost.Filesystem的但它似乎没有联系呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用的是OS X 10.7.3。我一直在玩,现在与升压头了一会儿,我想移动到使用Boost.Filesystem的LIB但它一直在我抛出这个消息:
适用于建筑x86_64的未定义符号:
提振::系统:: generic_category(),从引用:
__static_initialization_and_destruction_0(INT,INT)在ccOhIhNG.o
提高:: filesystem3 ::详细:: create_directories(升压:: filesystem3 ::路径常量和放大器;,提振::系统::错误_ code *)在libboost_filesystem.a(operations.o)
提高:: filesystem3 ::详细::规范(升压:: filesystem3 ::路径常量和放大器;,提振:: filesystem3 ::路径常量和放大器;,提振::系统::错误_ code *)在libboost_filesystem.a(操作的.o)
提振::系统:: system_category(),从引用:
__static_initialization_and_destruction_0(INT,INT)在ccOhIhNG.o
(匿名命名空间)::错误(布尔,升压::系统::错误_ code常量和放大器;,提振:: filesystem3 ::路径常量和放大器;,提振::系统::错误_ code *,性病:: basic_string的<焦炭,的std :: char_traits<焦炭>中的std ::分配器<&烧焦GT;>常量和放大器;在libboost_filesystem.a)(operations.o)
(匿名命名空间)::错误(布尔,提振:: filesystem3 ::路径常量和放大器;,提振::系统::错误_ code *,性病:: basic_string的<焦炭,的std :: char_traits<焦炭>中STD: :分配器<焦炭>>常量和放大器;在libboost_filesystem.a)(operations.o)
(匿名命名空间)::错误(布尔,提振:: filesystem3 ::路径常量和放大器;,提振:: filesystem3 ::路径常量和放大器;,提振::系统::错误_ code *,性病:: basic_string的<焦炭,的std :: char_traits<焦炭>中的std ::分配器<&烧焦GT;>常量和放大器;在libboost_filesystem.a)(operations.o)
在libboost_filesystem.a(operations.o);提高:: filesystem3 ::详细:: dir_itr_close(无效*放大器;,无效*&AMP)
提高:: filesystem3 ::详细:: directory_iterator_increment(升压:: filesystem3 :: directory_itera器和放大器;,提振::系统::错误_ code *)在libboost_filesystem.a(operations.o)
提高:: filesystem3 ::详细:: directory_iterator_construct(升压:: filesystem3 :: directory_itera器和放大器;,提振:: filesystem3 ::路径常量和放大器;,提振::系统::错误_ code *)在libboost_filesystem.a(操作的.o)
...
LD:符号(S)未找到x86_64的架构
collect2:劳工处返回1退出状态
我得到这个当我尝试使用该编译:
G ++ -o测试的main.cpp -I -l /选择/本地/包括〜/升压/库/ libboost_filesystem.a
所以我又回到了boost.org教程和尝试了正则表达式的例子。它的工作完美地使用这样的:
G ++ -o测试的main.cpp -I -l /选择/本地/包括〜/升压/库/ libboost_regex.a
解决方案
尝试
G ++ -o测试的main.cpp -I /选择/本地/ -L包含的/ opt / local / lib目录-lboost_filesystem
I'm using OS X 10.7.3. I've been playing with the boost headers for a while now and i wanted to move onto using the Boost.Filesystem lib however it keeps throwing this message at me:
Undefined symbols for architecture x86_64:
"boost::system::generic_category()", referenced from:
__static_initialization_and_destruction_0(int, int)in ccOhIhNG.o
boost::filesystem3::detail::create_directories(boost::filesystem3::path const&, boost::system::error_code*)in libboost_filesystem.a(operations.o)
boost::filesystem3::detail::canonical(boost::filesystem3::path const&, boost::filesystem3::path const&, boost::system::error_code*)in libboost_filesystem.a(operations.o)
"boost::system::system_category()", referenced from:
__static_initialization_and_destruction_0(int, int)in ccOhIhNG.o
(anonymous namespace)::error(bool, boost::system::error_code const&, boost::filesystem3::path const&, boost::system::error_code*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in libboost_filesystem.a(operations.o)
(anonymous namespace)::error(bool, boost::filesystem3::path const&, boost::system::error_code*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in libboost_filesystem.a(operations.o)
(anonymous namespace)::error(bool, boost::filesystem3::path const&, boost::filesystem3::path const&, boost::system::error_code*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in libboost_filesystem.a(operations.o)
boost::filesystem3::detail::dir_itr_close(void*&, void*&)in libboost_filesystem.a(operations.o)
boost::filesystem3::detail::directory_iterator_increment(boost::filesystem3::directory_itera tor&, boost::system::error_code*)in libboost_filesystem.a(operations.o)
boost::filesystem3::detail::directory_iterator_construct(boost::filesystem3::directory_itera tor&, boost::filesystem3::path const&, boost::system::error_code*)in libboost_filesystem.a(operations.o)
...
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
i get this when i try to compile using this:
g++ -o test main.cpp -I -l/opt/local/include ~/boost/libs/libboost_filesystem.a
So i went back to the boost.org tutorials and tried out the regex example. It worked perfectly using this:
g++ -o test main.cpp -I -l/opt/local/include ~/boost/libs/libboost_regex.a
解决方案
try
g++ -o test main.cpp -I/opt/local/include -L/opt/local/lib -lboost_filesystem
这篇关于尝试使用Boost.Filesystem的但它似乎没有联系呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文