我试着让网站上的一个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 ==========我有点不确定到底该怎么做才能弥补这个问题?
发布于 2011-10-25 01:50:35
将指令添加到“stdAfx.h”或重新生成预编译头
您的项目配置了预编译头支持,但您尚未在源文件中包含预编译头。
预编译头文件(在本例中为StdAfx.h)需要包含在每个配置为使用预编译头的源文件的最顶部。
包括此文件或禁用预编译头文件(在项目属性中,在C/C++ ->预编译头文件下,将预编译头文件属性设置为“不使用预编译头文件;也可以为单个源文件设置该属性)。”
发布于 2011-10-25 01:50:29
警告和错误非常清楚;在包含标准和Boost头文件之前,需要将#include "StdAfx.h"添加到highfreqdemo.cpp文件中。
https://stackoverflow.com/questions/7879584
复制相似问题