SystemCプロジェクトでブーストプロパティツリーを使用しようとしています。プロジェクトの用途:
gcc 4.6.3
systemc 2.2
boost 1.46
ヘッダ:
#include <typeinfo>
#include <map>
#include <vector>
#include <string>
#include <exception>
#include <boost/property_tree/ptree.hpp> <-- line 17
class PersistenceProvider
{
static PersistenceProvider* m_instance;
//! private constructor to assure there is one instance
PersistenceProvider();
std::string GetTypePath(const std::string &name) const ;
std::string GetValuePath(const std::string &name)const ;
boost::property_tree::ptree m_ptree;
public:
//! returns the current instance of the persistence provider
static PersistenceProvider* getInstance();
~PersistenceProvider();
template <class T>
T get(std::string path);
template <class T>
void set(std::string path, T data);
};
コード:
template <class T>
T PersistenceProvider::get(const std::string path)
{
const std::string typePath = GetTypePath(path);
std::string type = m_ptree.get<std::string>(typePath);
if(typeid(T).name() != type)
{
assert("wrong type");
}
const std::string dataPath = GetValuePath(path);
return m_ptree.get<T >(dataPath);
}
template <class T>
void PersistenceProvider::set(const std::string path, const T data)
{
std::string type = typeid(T).name();
const std::string typePath = GetTypePath(path);
m_ptree.put<std::string >(typePath, type, true);
const std::string dataPath = GetValuePath(path);
m_ptree.put<T >(dataPath, data, true);
}
しかし、property_tree.hppをヘッダーファイルに追加すると、gccは次のようにスローします。
In file included from /usr/include/boost/type_traits/is_reference.hpp:17:0,
from /usr/include/boost/type_traits/intrinsics.hpp:132,
from /usr/include/boost/type_traits/alignment_of.hpp:15,
from /usr/include/boost/optional/optional.hpp:24,
from /usr/include/boost/optional.hpp:15,
from /usr/include/boost/property_tree/id_translator.hpp:16,
from /usr/include/boost/property_tree/string_path.hpp:15,
from /usr/include/boost/property_tree/ptree.hpp:16,
from ../src/tb_systemc/../behavior_systemc/PersistenceProvider.h:17,
...
/usr/include/boost/type_traits/is_rvalue_reference.hpp:21:1: error: template argument 1 is invalid
In file included from /usr/include/boost/type_traits/intrinsics.hpp:133:0,
from /usr/include/boost/type_traits/alignment_of.hpp:15,
from /usr/include/boost/optional/optional.hpp:24,
from /usr/include/boost/optional.hpp:15,
from /usr/include/boost/property_tree/id_translator.hpp:16,
from /usr/include/boost/property_tree/string_path.hpp:15,
from /usr/include/boost/property_tree/ptree.hpp:16,
from ../src/tb_systemc/../behavior_systemc/PersistenceProvider.h:17,
...
/usr/include/boost/type_traits/is_volatile.hpp:60:35: error: template argument 1 is invalid
In file included from /usr/include/boost/type_traits/is_member_function_pointer.hpp:25:0,
from /usr/include/boost/type_traits/is_member_pointer.hpp:28,
from /usr/include/boost/type_traits/is_pointer.hpp:24,
from /usr/include/boost/type_traits/is_scalar.hpp:14,
from /usr/include/boost/type_traits/is_pod.hpp:14,
from /usr/include/boost/type_traits/has_trivial_constructor.hpp:14,
from /usr/include/boost/type_traits/has_nothrow_constructor.hpp:12,
from /usr/include/boost/optional/optional.hpp:25,
from /usr/include/boost/optional.hpp:15,
from /usr/include/boost/property_tree/id_translator.hpp:16,
from /usr/include/boost/property_tree/string_path.hpp:15,
from /usr/include/boost/property_tree/ptree.hpp:16,
from ../src/tb_systemc/../behavior_systemc/PersistenceProvider.h:17,
...
/usr/include/boost/type_traits/remove_cv.hpp:44:36: error: template argument 1 is invalid
In file included from /usr/include/boost/optional/optional.hpp:26:0,
from /usr/include/boost/optional.hpp:15,
from /usr/include/boost/property_tree/id_translator.hpp:16,
from /usr/include/boost/property_tree/string_path.hpp:15,
from /usr/include/boost/property_tree/ptree.hpp:16,
from ../src/tb_systemc/../behavior_systemc/PersistenceProvider.h:17,
...
/usr/include/boost/type_traits/type_with_alignment.hpp:206:5: error: ‘found’ is not a type
/usr/include/boost/type_traits/type_with_alignment.hpp:206:5: error: expected ‘,’ or ‘...’ before ‘>=’ token
/usr/include/boost/type_traits/type_with_alignment.hpp:207:5: error: ‘found’ is not a type
/usr/include/boost/type_traits/type_with_alignment.hpp:207:5: error: expected ‘,’ or ‘...’ before ‘%’ token
/usr/include/boost/type_traits/type_with_alignment.hpp:207:5: error: ‘int boost::detail::type_with_alignment_imp<Align>::static_assert(int)’ cannot be overloaded
/usr/include/boost/type_traits/type_with_alignment.hpp:206:5: error: with ‘int boost::detail::type_with_alignment_imp<Align>::static_assert(int)’
...
そしてもう少し同じことを言っています。
これは、使用中ではなく、インクルード時に発生します。これは、インクルードまたは名前空間が欠落していることが原因である可能性がありますか?