C ++文件,包括升压:ASIO [英] c++ files to include for boost : asio

查看:90
本文介绍了C ++文件,包括升压:ASIO的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在下面的本教程但它没有说明我需要它libaries为了得到推动工作,包括联系当前选项有:

I'm following this tutorial however it does not state which libaries I need to include in order to get boost to work,current options for links are:

-I/usr/include/opencv2 -I/usr/include/boost_1_55_0 -I/usr/include/boost_1_55_0/boost -O0 -g3 -Wall -c -fmessage-length=0

然而,这将返回以下埃罗:

however this returns the following erro:

其中指出,无法找到ASIO,我是不是做错了什么或者是Assio酒店错误的库链接到?或有任何其他方式找出来。请注意,这是我的第二个C ++项目(通过我有很多java的经验),并先用大量使用图书馆等等细节有些必需的。

which states that it can't find asio, am I doing something wrong or was assio the wrong library to link to? Or is there any other way to find out. Note that this is my 2nd c++ project(through I have a lot of java experience) and first with the heavy use of libraries so details are somewhat required.

删除升压/ ASIO给了我以下错误:

Removing boost/asio gave me the following errors:

make all 
Building target: DisplayImage
Invoking: GCC C++ Linker
g++ -L/usr/include/opencv2 -L/usr/include/boost_1_55_0/boost -L/usr/include/boost_1_55_0 -L/usr/include/opencv2 -L/usr/lib -o "DisplayImage"  ./src/Cap.o ./src/DisplayImage.o ./src/Filters.o ./src/sender.o   -lopencv_imgproc -lopencv_highgui -lopencv_core
./src/sender.o: In function `__static_initialization_and_destruction_0':
/usr/include/boost_1_55_0/boost/system/error_code.hpp:222: undefined reference to `boost::system::generic_category()'
/usr/include/boost_1_55_0/boost/system/error_code.hpp:223: undefined reference to `boost::system::generic_category()'
/usr/include/boost_1_55_0/boost/system/error_code.hpp:224: undefined reference to `boost::system::system_category()'
./src/sender.o: In function `error_code':
/usr/include/boost_1_55_0/boost/system/error_code.hpp:323: undefined reference to `boost::system::system_category()'
./src/sender.o: In function `boost::asio::error::get_system_category()':
/usr/include/boost_1_55_0/boost/asio/error.hpp:224: undefined reference to `boost::system::system_category()'
collect2: ld returned 1 exit status
make: *** [DisplayImage] Error 1

的BUILD成品**

Build Finished **

我用一个Ubuntu(x64)的笔记本电脑,如果它很重要。

I use an ubuntu (x64) laptop if it matters.

推荐答案

大多数升压的是什么所谓的仅标头code语言实现的。通过大量使用的C ++模板,没有实际的库code,你的code需要链接到。不过,也有,因为你已经看到了一些实际的图书馆也是如此。通常情况下,你寻求帮助可能是在这里:<一href=\"http://www.boost.org/doc/libs/1_55_0/more/getting_started/unix-variants.html#link-your-program-to-a-boost-library\" rel=\"nofollow\">http://www.boost.org/doc/libs/1_55_0/more/getting_started/unix-variants.html#link-your-program-to-a-boost-library

Most of boost is implemented in what's called "header-only" code. Through the generous use of C++ templates, there is no actual library code to which your code needs to link. However, there are, as you've seen some actual libraries as well. Generally, the help you seek is probably here: http://www.boost.org/doc/libs/1_55_0/more/getting_started/unix-variants.html#link-your-program-to-a-boost-library

您特定的程序使用定时系统图书馆等你也许可以使用这个命令行链接你的程序:

Your particular program uses the timer and system libraries and so you can probably use this command line to link your program:

g++ timer.cpp -o timer -lboost_timer -lboost_system

这篇关于C ++文件,包括升压:ASIO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆