【发布时间】:2011-04-14 12:48:05
【问题描述】:
我正在尝试使用 boost.asio 来实现多播发送器。我有一个我的线程实现,我只需要我的 boost.asio 来管理套接字。
我查看了 boost 网站上的示例,但我不明白,我不明白 编译。我在哪里可以找到我需要的东西?
编译错误是: (我试过这个例子:http://www.boost.org/doc/libs/1_46_1/doc/html/boost_asio/example/multicast/sender.cpp)
错误 3 错误 C2653: 'asio' : is not a 类或命名空间名称 c:\Documents 和 Settings\GG\Desktop\sender.cpp 2
错误 4 错误 C2653: 'asio' : is not a 类或命名空间名称 c:\Documents 和 Settings\GG\Desktop\sender.cpp 24
错误 5 错误 C2143:语法错误: 在 '&' c:\Documents 之前缺少 ')' 和 Settings\GG\Desktop\sender.cpp 24
错误 6 错误 C2143:语法错误: 失踪 ';'在'&'之前 c:\Documents 和 Settings\GG\Desktop\sender.cpp 24
错误 7 错误 C2460: 'sender::io_service' : 使用'sender', 正在定义 c:\Documents 和 Settings\GG\Desktop\sender.cpp 24
错误 8 错误 C4430:缺少类型 说明符 - 假定为 int。注意:C++ 不支持 默认整数 c:\Documents 和 Settings\GG\Desktop\sender.cpp 24
错误 9 错误 C2653: 'asio' : is not a 类或命名空间名称 c:\Documents 和 Settings\GG\Desktop\sender.cpp 24
错误 10 错误 C2143:语法错误: 失踪 ';'在'&'之前 c:\Documents 和 Settings\GG\Desktop\sender.cpp 24
错误 11 错误 C4430:缺少类型 说明符 - 假定为 int。注意:C++ 不支持 默认整数 c:\Documents 和 Settings\GG\Desktop\sender.cpp 24
错误 13 错误 C2059:语法错误: ')' c:\Documents 和 Settings\GG\Desktop\sender.cpp 24
错误 14 错误 C2065: 'multicast_address':未声明 标识符 c:\Documents 和 Settings\GG\Desktop\sender.cpp 26
错误 15 错误 C3861:“端点_”: 未找到标识符 c:\Documents 和 Settings\GG\Desktop\sender.cpp 26
错误 16 错误 C2531: 'sender::multicast_address' : 引用位域 非法 c:\Documents 和 Settings\GG\Desktop\sender.cpp 26
错误 17 错误 C4430:缺少类型 说明符 - 假定为 int。注意:C++ 不支持 默认整数 c:\Documents 和 Settings\GG\Desktop\sender.cpp 26
错误 18 错误 C2327: 'sender::io_service' : 不是类型 名称、静态或 枚举器 c:\Documents 和 Settings\GG\Desktop\sender.cpp 27
错误 19 错误 C2061:语法错误: 标识符“io_service”c:\Documents 和 Settings\GG\Desktop\sender.cpp 27
错误 20 错误 C2059:语法错误: ')' c:\Documents 和 Settings\GG\Desktop\sender.cpp 27
错误 21 错误 C2061:语法错误: 标识符 'timer_' c:\Documents 和 Settings\GG\Desktop\sender.cpp 28
错误 22 错误 C2143:语法错误: 在 '{' c:\Documents 之前缺少 ')' 和 Settings\GG\Desktop\sender.cpp 30
错误 23 错误 C4430:缺少类型 说明符 - 假定为 int。注意:C++ 不支持 默认整数 c:\Documents 和 Settings\GG\Desktop\sender.cpp 30
错误 24 错误 C2143:语法错误: 失踪 ';'在'{'之前 c:\Documents 和 Settings\GG\Desktop\sender.cpp 39
错误 25 错误 C2334:意外 '{'之前的标记;跳过 明显的函数体 c:\Documents 和 Settings\GG\Desktop\sender.cpp 39
错误 26 致命错误 C1004:意外 找到文件结尾 c:\Documents 和 Settings\GG\Desktop\sender.cpp 100
【问题讨论】:
-
为什么不能编译?您收到了哪些错误消息?
-
我尝试编译 sender.cpp(多播)我有这个错误:错误 1 致命错误 C1083:无法打开包含文件:'asio.hpp':如果我更改,则没有这样的文件或目录包含其中:#include
我有 23 错误:错误 3 错误 C2653:'asio':不是类或命名空间名称 c:\Documents and Settings\Gianluigi\Desktop\sender.cpp 24 错误4 error C2653: 'asio' : is not a class or namespace name c:\Documents and Settings\Gianluigi\Desktop\sender.cpp 24 etc... -
您应该发布整个示例代码。你复制了整个文件吗? boost.org/doc/libs/1_46_1/doc/html/boost_asio/example/multicast/…
-
@GgSalent 用编译错误编辑您的问题,很难作为评论阅读。
-
@Sam 我用编译错误编辑了我的帖子。你能帮帮我吗?
标签: c++ windows-xp boost-asio multicast sender