2011-12-24 23 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文件頭共享相同的名稱。這會給你帶來悲傷的結局。