Boost 示例无法在 VS2010 上编译?

发布于 2024-12-12 02:38:31 字数 2626 浏览 0 评论 0 原文

我试图从网站上获取一个 boost 示例来工作:

http://www.boost.org/doc/libs/1_47_0/doc/html/boost_asio/example/http/client/async_client.cpp

但每当我构建并尝试执行时,我不断从 VS2010 收到以下信息:

1>------ Build started: Project: highfreqdemo, Configuration: Debug Win32 ------
1>Build started 24/10/2011 18:41:08.
1>InitializeBuildStatus:
1>  Touching "Debug\highfreqdemo.unsuccessfulbuild".
1>ClCompile:
1>  All outputs are up-to-date.
1>  highfreqdemo.cpp
1>c:\users\x\documents\visual studio 2010\projects\highfreqdemo\highfreqdemo\highfreqdemo.cpp(4): warning C4627: '#include <iostream>': skipped when looking for precompiled header use
1>          Add directive to 'StdAfx.h' or rebuild precompiled header
1>c:\users\x\documents\visual studio 2010\projects\highfreqdemo\highfreqdemo\highfreqdemo.cpp(5): warning C4627: '#include <istream>': skipped when looking for precompiled header use
1>          Add directive to 'StdAfx.h' or rebuild precompiled header
1>c:\users\x\documents\visual studio 2010\projects\highfreqdemo\highfreqdemo\highfreqdemo.cpp(6): warning C4627: '#include <ostream>': skipped when looking for precompiled header use
1>          Add directive to 'StdAfx.h' or rebuild precompiled header
1>c:\users\x\documents\visual studio 2010\projects\highfreqdemo\highfreqdemo\highfreqdemo.cpp(7): warning C4627: '#include <string>': skipped when looking for precompiled header use
1>          Add directive to 'StdAfx.h' or rebuild precompiled header
1>c:\users\x\documents\visual studio 2010\projects\highfreqdemo\highfreqdemo\highfreqdemo.cpp(8): warning C4627: '#include <boost/asio.hpp>': skipped when looking for precompiled header use
1>          Add directive to 'StdAfx.h' or rebuild precompiled header
1>c:\users\x\documents\visual studio 2010\projects\highfreqdemo\highfreqdemo\highfreqdemo.cpp(9): warning C4627: '#include <boost/bind.hpp>': skipped when looking for precompiled header use
1>          Add directive to 'StdAfx.h' or rebuild precompiled header
1>c:\users\x\documents\visual studio 2010\projects\highfreqdemo\highfreqdemo\highfreqdemo.cpp(199): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.76
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

我有点不确定到底该怎么做才能解决这个问题?

I was trying to get one of the boost examples from the website to work:

http://www.boost.org/doc/libs/1_47_0/doc/html/boost_asio/example/http/client/async_client.cpp

but whenever I built and tried to execute, I kept getting the following from VS2010:

1>------ Build started: Project: highfreqdemo, Configuration: Debug Win32 ------
1>Build started 24/10/2011 18:41:08.
1>InitializeBuildStatus:
1>  Touching "Debug\highfreqdemo.unsuccessfulbuild".
1>ClCompile:
1>  All outputs are up-to-date.
1>  highfreqdemo.cpp
1>c:\users\x\documents\visual studio 2010\projects\highfreqdemo\highfreqdemo\highfreqdemo.cpp(4): warning C4627: '#include <iostream>': skipped when looking for precompiled header use
1>          Add directive to 'StdAfx.h' or rebuild precompiled header
1>c:\users\x\documents\visual studio 2010\projects\highfreqdemo\highfreqdemo\highfreqdemo.cpp(5): warning C4627: '#include <istream>': skipped when looking for precompiled header use
1>          Add directive to 'StdAfx.h' or rebuild precompiled header
1>c:\users\x\documents\visual studio 2010\projects\highfreqdemo\highfreqdemo\highfreqdemo.cpp(6): warning C4627: '#include <ostream>': skipped when looking for precompiled header use
1>          Add directive to 'StdAfx.h' or rebuild precompiled header
1>c:\users\x\documents\visual studio 2010\projects\highfreqdemo\highfreqdemo\highfreqdemo.cpp(7): warning C4627: '#include <string>': skipped when looking for precompiled header use
1>          Add directive to 'StdAfx.h' or rebuild precompiled header
1>c:\users\x\documents\visual studio 2010\projects\highfreqdemo\highfreqdemo\highfreqdemo.cpp(8): warning C4627: '#include <boost/asio.hpp>': skipped when looking for precompiled header use
1>          Add directive to 'StdAfx.h' or rebuild precompiled header
1>c:\users\x\documents\visual studio 2010\projects\highfreqdemo\highfreqdemo\highfreqdemo.cpp(9): warning C4627: '#include <boost/bind.hpp>': skipped when looking for precompiled header use
1>          Add directive to 'StdAfx.h' or rebuild precompiled header
1>c:\users\x\documents\visual studio 2010\projects\highfreqdemo\highfreqdemo\highfreqdemo.cpp(199): fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "StdAfx.h"' to your source?
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.76
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I am a little unsure what exactly to do to remedy this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

是你 2024-12-19 02:38:31
向“StdAfx.h”添加指令或重建预编译头

您的项目配置了预编译头支持,但您尚未在源文件中包含预编译头。

预编译头文件(在本例中为 StdAfx.h)需要包含在配置为使用预编译头的每个源文件的最顶部。

包含此文件或禁用预编译头(在项目属性中,在 C/C++ -> 预编译头下,将预编译头属性设置为“不使用预编译头;”这也可以为单个源文件设置)。

Add directive to 'StdAfx.h' or rebuild precompiled header

Your project is configured with precompiled header support but you have not included the precompiled header in your source file.

The precompiled header file (in this case, StdAfx.h) needs to be included at the very top of every source file that is configured to use the precompiled header.

Either include this file or disable precompiled headers (In the project properties, under C/C++ -> Precompiled Headers, set the Precompiled Header property to "Not Using Precompiled Headers;" this can be set for individual source files as well).

给不了的爱 2024-12-19 02:38:31

警告和错误非常清楚;在包含标准和 Boost 标头之前,您需要将 #include "StdAfx.h" 添加到 highfreqdemo.cpp 文件中。

The warnings and errors are pretty clear; you need to add #include "StdAfx.h" to your highfreqdemo.cpp file, before including the standard and Boost headers.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文