You are not logged in.

#1 2005-12-03 20:59:59

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

C++ compilation problem

I am trying to compile openvrml which uses the boost library. I get the following error:

/usr/include/boost/numeric/conversion/detail/converter.hpp:233: error: expected unqualified-id before numeric constant
/usr/include/boost/numeric/conversion/detail/converter.hpp:238: error: type/value mismatch at argument 6 in template parameter list for 'template<class expr0, class expr1, class TT, class TF, class FT, class FF> struct boost::numeric::convdetail::for_both'
/usr/include/boost/numeric/conversion/detail/converter.hpp:238: error:   expected a type, got '0l'
/usr/include/boost/numeric/conversion/detail/converter.hpp:238: error: 'type' does not name a type

The code in question is :

    template<class PredA, class PredB>
    struct combine
    {
      typedef applyBoth<PredA,PredB> Both ;
      typedef void                   None ;       //line number 233

      typedef typename PredA::do_apply do_applyA ;
      typedef typename PredB::do_apply do_applyB ;

      typedef typename for_both<do_applyA, do_applyB, Both, PredA, PredB, None>::type type ; //line number 238
    } ;

Anyone knows what these error means or how to get rid of them?

Offline

#2 2005-12-03 21:47:56

Cerebral
Forum Fellow
From: Waterloo, ON, CA
Registered: 2005-04-08
Posts: 3,108
Website

Re: C++ compilation problem

Well, I know the error on line 238 is caused because the typedef void None is failing on line 233.  Not sure how to fix line 233 though... sad

Offline

#3 2005-12-03 21:56:27

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: C++ compilation problem

I didn't mentionned it in my first post but commenting out line 233 and replacing 'None' by 'void' in line 238 solved the compilation problem.  Since it is based on only  an educated guess,  I have no idea if it's a valid (or the best?) solution. :?

Offline

#4 2005-12-03 23:59:17

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: C++ compilation problem

"None" is already defined in Xlib.h - that's probably where the error is coming from.

Offline

#5 2005-12-04 00:40:13

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: C++ compilation problem

phrakture wrote:

"None" is already defined in Xlib.h - that's probably where the error is coming from.

Doesn't seem to be the case:

 $ grep None /usr/X11R6/include/X11/Xlib.h
    Pixmap background_pixmap;   /* background or None or ParentRelative */
    Cursor cursor;              /* cursor to be displayed (or None) */
         * NotifyPointerRoot, NotifyDetailNone 
        Atom property;          /* ATOM or None */
        Colormap colormap;      /* COLORMAP or None */
    Font font;                  /* font to print it in, None don't change */
    Font font;                  /* font to print it in, None don't change */
#define XIMPreeditNone          0x0010L
#define XIMStatusNone           0x0800L
#define XLookupNone             1

Offline

#6 2005-12-04 06:46:27

codemac
Member
From: Cliche Tech Place
Registered: 2005-05-13
Posts: 794
Website

Re: C++ compilation problem

I don't understand why you are typdefing a keyword directly.  Why not just use void?  Maybe I'm missing something.

Offline

#7 2005-12-04 08:32:44

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: C++ compilation problem

codemac wrote:

I don't understand why you are typdefing a keyword directly.  Why not just use void?  Maybe I'm missing something.

That's because I didn't wrote the code I posted. wink   It comes from /usr/include/boost/numeric/conversion/detail/converter.hpp wich is part of the boost library.  I don't know C++.  I basically want to know if there is a problem with that code snippet before reporting that as a bug on the boost ML. :?

Offline

#8 2005-12-04 18:14:33

codemac
Member
From: Cliche Tech Place
Registered: 2005-05-13
Posts: 794
Website

Re: C++ compilation problem

Well, I think it's safe to say it's a bug, because None clearly must be defined somewhere else.  It expected an "unqualified-id," or something not all ready defined.  I think then you should also bring up in the ML that typedef-ing a single keyword to something else is truly a waste of time, effort and thought IMHO :-P.

Offline

#9 2005-12-04 18:23:15

Cerebral
Forum Fellow
From: Waterloo, ON, CA
Registered: 2005-04-08
Posts: 3,108
Website

Re: C++ compilation problem

It's in X.h

$ grep " None " /usr/X11R6/include/X11/X.h
#define None                 0L    /* universal null resource or null atom */

Offline

#10 2005-12-04 21:19:38

phrakture
Arch Overlord
From: behind you
Registered: 2003-10-29
Posts: 7,879
Website

Re: C++ compilation problem

Yeah Cerebral got it - when I said it's defined in Xlib.h, I kinda meant "Xlib.h and any of the 5 jillion headers it pulls in with it"

So here's what happens:

#define None 0L
...
typedef void None;

becomes:

typedef void 0L; //ACK! FAIL!

Offline

#11 2005-12-04 21:33:05

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: C++ compilation problem

Thanks everyone! big_smile  I'll report that on the boost ML.

Offline

Board footer

Powered by FluxBB