2013-08-21 78 views
0

我目前正在开发的XCode,当我试图包含字符串的XCode头错误 -

#include <string> 

一切都很好,但是当我包括CryptoPP头,其中包括<字符串>

#include "integer.h" //integer.h have #include <string> in it 

编译时出现以下错误

bits/basic_string.tcc:63:11: Cannot define or redeclare '_S_max_size' here because  namespace '_STL' does not enclose namespace '_Rep' 
bits/basic_string.tcc:63:28: Use of undeclared identifier 'npos'; did you mean 'fpos'? 
bits/basic_string.tcc:63:28: Use of class template fpos requires template arguments 
bits/basic_string.tcc:63:33: Expected ')' 
bits/basic_string.tcc:68:11: Cannot define or redeclare '_S_terminal' here because namespace '_STL' does not enclose namespace '_Rep' 
bits/basic_string.tcc:72:44: Cannot define or redeclare 'npos' here because namespace '_STL' does not enclose namespace 'basic_string' 
bits/basic_string.tcc:99:2: Unknown type name 'size_type'; did you mean 'size_t'? 
bits/basic_string.tcc:100:9: Use of undeclared identifier '__beg' 
bits/basic_string.tcc:100:9: Use of undeclared identifier '__end' 
bits/basic_string.tcc:100:9: Use of undeclared identifier '_Rep' 

等等......

这是系统头文件中的错误还是错误在编译器中?我使用苹果LLVM 4.2(我需要使用它)

回答

3

你不应该包括内部头文件。如果你想获得std::basic_string所需的声明,包括<string>

+0

其实它的CryptoPP代码,它在代码中包含这样几次。 – bartimar

+0

@bartimar:只是因为图书馆使用了某些东西才是正确的!我下载了CryptoPP-5.6.2,它不包含任何这样的头文件。内部标准库头是标准库的唯一业务。 –

+0

Cryptopp integer - > cryptlib - > stdcpp - > string - > basic_string.tcc(箭头表示包含) – bartimar