2011-12-24 22 views
4
xcode 4.2 
os x 10.7 

当我把我的包含的样子:如何强制Xcode中使用正确的iostream头C++

#include <iostream> 
#include <boost/thread.hpp> 

我从位于/opt/local/include/boost/tr1/tr1

Lexical or Preprocessor Issue 
'boost/tr1/detail/config_all.hpp' file not found 
一个文件下面的错误

/opt/local/include/boost/tr1/tr1/iostream文件的内容:

// (C) Copyright John Maddock 2005. 
// Use, modification and distribution are subject to the 
// Boost Software License, Version 1.0. (See accompanying file 
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 
// 
// This file exists to prevent std lib headers from accidentally 
// including a TR1 extention header; we must suppress this otherwise 
// we can end up with cyclic dependencies with some std lib implementations. 
// 
#ifndef BOOST_TR1_iostream_INCLUDED 
# define BOOST_TR1_iostream_INCLUDED 
# ifndef BOOST_TR1_NO_RECURSION 
#  define BOOST_TR1_NO_RECURSION 
#  define BOOST_TR1_NO_iostream_RECURSION 
# endif 
# include <boost/tr1/detail/config_all.hpp> 
# if defined(BOOST_HAS_INCLUDE_NEXT) && !defined(BOOST_TR1_DISABLE_INCLUDE_NEXT) 
#  include_next <iostream> 
# else 
#  include BOOST_TR1_STD_HEADER(iostream) 
# endif 
# ifdef BOOST_TR1_NO_iostream_RECURSION 
#  undef BOOST_TR1_NO_iostream_RECURSION 
#  undef BOOST_TR1_NO_RECURSION 
# endif 
#endif 

我应该使用位于/Developer/SDKs/MacOSX10.7.sdk/usr/include/c++/4.2.1/

的iostream头你要原谅我,因为我很新的C++,甚至更多的新Xcode的。预先感谢您的任何帮助。

+0

你究竟做了什么来定制你的包含路径,以便它首先在/ opt中查找? – servn 2011-12-24 05:16:13

+0

如果我在启动之前启动了包含路径,它会引发各种错误。也许我需要取消递归搜索.... – Wes 2011-12-24 05:32:58

+0

或者更确切地说,要让它搜索具体提升的哪些部分,而不是全部提升。我只是怕,如果我不包括所有的提振,它会打破事情。我对此很陌生,很确定。 – Wes 2011-12-24 05:34:22

回答

3

绝对关闭递归搜索。如果不指定完整的升压路径,则永远不能包含升压头。大部分的Boost都是一些功能的培训基地,最终将成为标准,因此有很多Boost标题与标准标题共享相同的名称。还有一些boost头文件与其他boost文件头共享相同的名称。这会给你带来悲伤的结局。