编译远程网提升示例时遇到问题
Trouble compiling telnet boost example
我正在尝试编译这个程序:
http://lists.boost.org/boost-users/att-40895/telnet.cpp在装有 OS X 10.7.3 的 Mac 上。
我正在使用这一行来编译:
g++ -O3 telnet.cpp -o telnet
我收到此错误:
Undefined symbols for architecture x86_64:
"boost::system::generic_category()", referenced from:
global constructors keyed to _ZN12_GLOBAL__N_12_1Ein cc4A3W1S.o
"boost::system::system_category()", referenced from:
global constructors keyed to _ZN12_GLOBAL__N_12_1Ein cc4A3W1S.o
boost::asio::detail::posix_thread::func<boost::asio::detail::resolver_service_base::work_io_service_runner>::run()in cc4A3W1S.o
boost::asio::detail::reactive_socket_connect_op_base::do_perform(boost::asio::detail::reactor_op*)in cc4A3W1S.o
boost::asio::detail::socket_ops::translate_netdb_error(int) in cc4A3W1S.o
boost::asio::ip::basic_resolver_iterator<boost::asio::ip::tcp>::create(addrinfo*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in cc4A3W1S.o
boost::asio::detail::socket_ops::translate_addrinfo_error(int) in cc4A3W1S.o
boost::asio::detail::kqueue_reactor::run(bool, boost::asio::detail::op_queue<boost::asio::detail::task_io_service_operation>&)in cc4A3W1S.o
...
"vtable for boost::detail::thread_data_base", referenced from:
boost::detail::thread_data_base::thread_data_base()in cc4A3W1S.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"boost::detail::thread_data_base::~thread_data_base()", referenced from:
boost::detail::thread_data<boost::_bi::bind_t<unsigned long, boost::_mfi::mf0<unsigned long, boost::asio::io_service>, boost::_bi::list1<boost::_bi::value<boost::asio::io_service*> > > >::~thread_data()in cc4A3W1S.o
boost::detail::thread_data<boost::_bi::bind_t<unsigned long, boost::_mfi::mf0<unsigned long, boost::asio::io_service>, boost::_bi::list1<boost::_bi::value<boost::asio::io_service*> > > >::~thread_data()in cc4A3W1S.o
"boost::thread::start_thread()", referenced from:
boost::thread::thread<boost::_bi::bind_t<unsigned long, boost::_mfi::mf0<unsigned long, boost::asio::io_service>, boost::_bi::list1<boost::_bi::value<boost::asio::io_service*> > > >(boost::_bi::bind_t<unsigned long, boost::_mfi::mf0<unsigned long, boost::asio::io_service>, boost::_bi::list1<boost::_bi::value<boost::asio::io_service*> > >, boost::disable_if<boost::is_convertible<boost::_bi::bind_t<unsigned long, boost::_mfi::mf0<unsigned long, boost::asio::io_service>, boost::_bi::list1<boost::_bi::value<boost::asio::io_service*> > >&, boost::detail::thread_move_t<boost::_bi::bind_t<unsigned long, boost::_mfi::mf0<unsigned long, boost::asio::io_service>, boost::_bi::list1<boost::_bi::value<boost::asio::io_service*> > > > >, boost::thread::dummy*>::type)in cc4A3W1S.o
"boost::thread::join()", referenced from:
_main in cc4A3W1S.o
"boost::thread::~thread()", referenced from:
_main in cc4A3W1S.o
"telnet_client::~telnet_client()", referenced from:
_main in cc4A3W1S.o
"typeinfo for boost::detail::thread_data_base", referenced from:
typeinfo for boost::detail::thread_data<boost::_bi::bind_t<unsigned long, boost::_mfi::mf0<unsigned long, boost::asio::io_service>, boost::_bi::list1<boost::_bi::value<boost::asio::io_service*> > > >in cc4A3W1S.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
从我迄今为止的研究来看,我想出的是我需要以某种方式链接到提升库。 我不知道如何判断它是否正确安装。 我下载了brew并使用
了brew install boost
来安装它。
对不起,如果格式错误,这是我的第一篇文章。 感谢您的帮助。如果我需要提供任何其他信息,请告诉我。
您忘记链接到 Boost 库。尝试:
g++ -O3 -o telnet telnet.cpp -lboost_system -lboost_thread
您可能需要 -l boost_thread-mt 而不是 -lboost_thread 我没有看过代码,但可能是这种情况
相关文章:
- 编译包含字符串的代码时遇到问题
- 在顶点着色器中使用 OpenGl 的未声明标识符,我在顶点着色器中绘制三角形时遇到问题
- 从其他类访问类时遇到问题
- 使用静态成员声明类时遇到问题
- C++ 填充数组时遇到问题
- 在将字符串放入字符串向量时遇到问题?
- 余数除法和不允许除以零 (c++) 时遇到问题
- 我在C++中使用 getline() 函数时遇到问题
- C++线程安全:如果只有一个线程可以写入非原子变量,但多个线程从中读取. 会遇到问题吗?
- 在我的四叉树实现中遇到问题
- 在 c++ 中循环遍历数组时遇到问题
- 使用 MinGW 在 Windows 上构建 GLEW 时遇到问题
- 编译 Cilk Plus 程序时遇到问题
- 存储另一个函数返回的布尔数组时遇到问题
- 我在 OpenGL 中显示图像时遇到问题
- 我在解决此错误时遇到问题.我正在努力在主函数中传递数组
- 在 for 循环中更新两个变量时遇到问题C++
- 为什么我的程序在打开网络设备时遇到问题
- 在 Tensorflow C++ 中使用 FIFOQueue 时遇到问题
- 为什么我在虚幻引擎中的多态性和接口方面遇到问题?