User forums > Help
Precompiled header gives me error: stray 216
smallB:
Guys, after precompiling a file (any file but included below some sample code) and including it via build options, I'm getting an error: stray 216. What is the cause of it?
I tried gcc 4.6 and gcc 4.6.1 and the result is the same.
--- Code: ---#ifndef IS_CHAR_H_INCLUDED
#define IS_CHAR_H_INCLUDED
#include <type_traits>
template<class Int_T>
struct Is_Char_
{
enum {value = false};
};
template<>
struct Is_Char_<char>
{
enum {value = true};
};
template<>
struct Is_Char_<unsigned char>
{
enum {value = true};
};
template<>
struct Is_Char_<signed char>
{
enum {value = true};
};
template<class Int_T>
struct Is_Char : Is_Char_<typename std::remove_cv<Int_T>::type>
{
};
#endif // IS_CHAR_H_INCLUDED
--- End code ---
MortenMacFly:
--- Quote from: smallB on October 28, 2011, 09:46:02 am ---What is the cause of it?
--- End quote ---
Works fine here. Probably a wrong encoding on your side?
smallB:
Try to precompile this:
--- Code: ---#ifndef PROMOTE_H_INCLUDED
#define PROMOTE_H_INCLUDED
#include <type_traits>
#include <boost/mpl/vector.hpp>
#include <boost/mpl/find.hpp>
#include <boost/mpl/next.hpp>
#include <boost/mpl/deref.hpp>
#include <boost/mpl/end.hpp>
#include "Is_Char.h"
template<class Integer>
struct Promote
{
static_assert(std::is_integral<Integer>::value,"Non Integer type is not allowed.");
/*Check correct type - depending on Integer being signed or unsigned*/
typedef typename std::conditional<std::is_signed<Integer>::value,
boost::mpl::vector<signed char,short,int,long,long long>,
boost::mpl::vector<unsigned char,unsigned short,unsigned int,long,long long>
>::type types;
/*Find this type from the list above - substituting Integer for signed or unsigned char iff Integer is of type char*/
typedef typename boost::mpl::find<types,
typename std::conditional<Is_Char<Integer>::value,
typename std::conditional<std::is_signed<Integer>::value,signed char,unsigned char>::type, Integer>::type>::type this_type;
/*If Integer is int and if size of it is == to long promote int to long long (iterate to next element twice)*/
typedef typename boost::mpl::eval_if<boost::mpl::bool_<((std::is_same<Integer,int>::value || std::is_same<Integer,unsigned int>::value)
&& (sizeof(int) == sizeof(long)))>,
boost::mpl::next<typename boost::mpl::next<this_type>::type>,
boost::mpl::next<this_type>
>::type next_type;
/*Check if iterator points within range or if one pass end which means that Integer was u/long long*/
typedef typename std::conditional<std::is_same<typename boost::mpl::end<types>::type,next_type>::value,Integer,typename boost::mpl::deref<next_type>::type>::type type;
};
#endif // PROMOTE_H_INCLUDED
--- End code ---
oBFusCATed:
Hm, have you tried to precompile from the command line, without using C::B?
If you have and it failed, too. Then your problem is in the compiler, not C::B.
You're using an experimental mode for the compiler and also you're pushing the limits by using TMP and boost...
p.s. Please don't post in this subforum if you are not posting patches or requests for help on developing a feature for C::B! This subforum is not for users of C::B, but developers (official or not)
MortenMacFly:
--- Quote from: smallB on October 28, 2011, 10:41:13 am ---Try to precompile this:
--- End quote ---
Doesn't work because of missing includes (Is_Char).
Navigation
[0] Message Index
[#] Next page
Go to full version