1

我正在尝试将 jsoncpp 集成到一个项目中。我的平台是 32 位 xubuntu,gcc 版本为 4.7.2。我尝试使用 debian 包,也是从最新的 jsoncpp 源构建的,两者都导致相同的问题。

我使用 CMake 进行构建。已成功找到 jsoncpp 包含和库。但是当我将包含添加到我的 CMake 包含时,我的空 brConfig 类(在第 51 行中只有一个 #include)的构建失败并出现以下错误:

[100%] Building CXX object CMakeFiles/brCore.dir/src/brConfig.cpp.o 
In file included  from /usr/include/c++/4.7/i686-linux-gnu/bits/c++config.h:414:0, 
from /usr/include/c++/4.7/string:40, 
from /home/hellhound/Repository/binrevengine/modules/brCore/trunk/include/brCore/brConfig.h:51, 
from /home/hellhound/Repository/binrevengine/modules/brCore/trunk/src/brConfig.cpp:25:
/usr/include/c++/4.7/i686-linux-gnu/bits/os_defines.h:45:19: Fehler: fehlender binärer Operator vor Token »(« 
In file included from /usr/include/c++/4.7/cwchar:46:0, 
from /usr/include/c++/4.7/bits/postypes.h:42, 
from /usr/include/c++/4.7/bits/char_traits.h:42, 
from /usr/include/c++/4.7/string:42, 
from /home/hellhound/Repository/binrevengine/modules/brCore/trunk/include/brCore/brConfig.h:51, 
from /home/hellhound/Repository/binrevengine/modules/brCore/trunk/src/brConfig.cpp:25: 
/usr/include/wchar.h:75:43: Fehler: fehlender binärer Operator vor Token »(« 
In file included from /usr/include/sched.h:43:0, 
from /usr/include/pthread.h:25, 
from /usr/include/c++/4.7/i686-linux-gnu/bits/gthr-default.h:41, 
from /usr/include/c++/4.7/i686-linux-gnu/bits/gthr.h:150, 
from /usr/include/c++/4.7/ext/atomicity.h:34, 
from /usr/include/c++/4.7/bits/basic_string.h:41, 
from /usr/include/c++/4.7/string:54, 
from /home/hellhound/Repository/binrevengine/modules/brCore/trunk/include/brCore/brConfig.h:51, 
from /home/hellhound/Repository/binrevengine/modules/brCore/trunk/src/brConfig.cpp:25: 
/usr/include/i386-linux-gnu/bits/sched.h:133:20: Fehler: fehlender binärer Operator vor Token »(« 
/usr/include/i386-linux-gnu/bits/sched.h:171:20: Fehler: fehlender binärer Operator vor Token »(« 
In file included from /usr/include/c++/4.7/cwchar:46:0, 
from /usr/include/c++/4.7/bits/postypes.h:42, 
from /usr/include/c++/4.7/bits/char_traits.h:42, 
from /usr/include/c++/4.7/string:42, 
from /home/hellhound/Repository/binrevengine/modules/brCore/trunk/include/brCore/brConfig.h:51, 
from /home/hellhound/Repository/binrevengine/modules/brCore/trunk/src/brConfig.cpp:25: 
/usr/include/wchar.h:104:1: Fehler: »__BEGIN_NAMESPACE_C99« bezeichnet keinen Typ /usr/include/wchar.h:107:1: Fehler: »__END_NAMESPACE_C99« bezeichnet keinen Typ /usr/include/wchar.h:135:1: Fehler: »__END_NAMESPACE_STD« bezeichnet keinen Typ /usr/include/wchar.h:149:6: Fehler: expected initializer before »__THROW« /usr/include/wchar.h:153:39: Fehler: expected initializer 
    [...]

在我看来,这个问题是由 std::string 包含调用的。知道出了什么问题吗?

这是我的简单课程:

#ifndef BINREV_CONFIG_H__
#define BINREV_CONFIG_H__

#include <string>      // compile fails here if I add JSON includes to CMAKE

namespace binrev{
namespace brCore{

class CORE_LIBRARY_API brConfig
{
   public: 
     brConfig();     
     virtual ~brConfig();

};
}//ns-brCore
}//ns-binrev
#endif //BINREV_CONFIG_H__
4

0 回答 0