[libannodex-dev] C++ clients and the use of 'class' asstructmember names.

Silvia.Pfeiffer at csiro.au Silvia.Pfeiffer at csiro.au
Fri Mar 10 12:15:47 EST 2006


Hmm, I guess I'll have to make another libcmml release with incompatible
API. :(
Thanks!
S.

> -----Original Message-----
> From: Ben Martin [mailto:monkeyiq at users.sourceforge.net] 
> Sent: Friday, 10 March 2006 11:04 AM
> To: Pfeiffer, Silvia (ICT Centre, Marsfield)
> Cc: libannodex-dev at lists.annodex.net
> Subject: RE: [libannodex-dev] C++ clients and the use of 
> 'class' asstructmember names.
> 
> 
> I tried such a trick before for another project's headers. 
> Unfortunately
> it doesn't work. Extern "C" only really effects linkage, the stuff in
> that block has to still parse ok as far as the c++ compiler is
> concerned. 
> 
> foo$ cat extern_c_bad_decl.cpp
> extern "C" {
>     struct foo
>     {
>         char* a;
>         int class;
>     };
> };
> 
> int main( int, char** )
> {
>     return -1;
> }
> foo$ g++ extern_c_bad_decl.cpp -o extern_c_bad_decl
> extern_c_bad_decl.cpp:5: error: expected identifier before ';' token
> extern_c_bad_decl.cpp:5: error: multiple types in one declaration
> extern_c_bad_decl.cpp:5: error: declaration does not declare anything
> 
> 
> On Fri, 2006-03-10 at 10:50 +1100, Silvia.Pfeiffer at csiro.au wrote:
> > Hi Ben,
> > 
> > Why can't you just use the
> > 
> > extern "C" {
> > }
> > 
> > declaration around these C header files in your C++ code?
> > 
> > Silvia.
> > 
> > 
> > > -----Original Message-----
> > > From: libannodex-dev-bounces at lists.annodex.net 
> > > [mailto:libannodex-dev-bounces at lists.annodex.net] On Behalf 
> > > Of Ben Martin
> > > Sent: Thursday, 9 March 2006 3:53 PM
> > > To: libannodex-dev at lists.annodex.net
> > > Subject: [libannodex-dev] C++ clients and the use of 'class' 
> > > as structmember names.
> > > 
> > > 
> > > Hi,
> > >   I might have forgotten to report this a while back :/
> > > 
> > >   I'm using these versions.
> > > libcmml-0.9.1-1.fc4
> > > libannodex-0.7.3-3.fc4
> > > 
> > >   And there are a few struct members which have a name 
> 'class' which
> > > makes C++ clients of both libraries fail to compile 
> without doing a
> > > little hacking on the cmml/annodex headers. I'm not sure 
> what you want
> > > to rename this member too, so patches not attached...
> > > 
> > > Thanks.
> > > 
> > > /usr/include/annodex/anx_types.h:75: error: expected 
> unqualified-id
> > > before 'class'
> > > /usr/include/annodex/anx_types.h:75: error: abstract 
> > > declarator 'char*'
> > > used as declaration
> > > /usr/include/annodex/anx_types.h:75: error: expected ';' 
> > > before 'class'
> > > /usr/include/annodex/anx_types.h:104: error: expected 
> unqualified-id
> > > before 'class'
> > > /usr/include/annodex/anx_types.h:104: error: abstract 
> > > declarator 'const
> > > char*' used as declaration
> > > /usr/include/annodex/anx_types.h:104: error: expected ';' 
> > > before 'class'
> > > /usr/include/cmml.h:209: error: expected unqualified-id 
> before 'class'
> > > /usr/include/cmml.h:209: error: abstract declarator 
> 'char*' used as
> > > declaration
> > > /usr/include/cmml.h:209: error: expected ';' before 'class'
> > > /usr/include/cmml.h:244: error: expected unqualified-id 
> before 'class'
> > > /usr/include/cmml.h:244: error: abstract declarator 
> 'char*' used as
> > > declaration
> > > /usr/include/cmml.h:244: error: expected ';' before 'class'
> > > 
> > > 
> > 
> > _______________________________________________
> > libannodex-dev mailing list
> > libannodex-dev at lists.annodex.net
> > http://lists.annodex.net/cgi-bin/mailman/listinfo/libannodex-dev
> 



More information about the libannodex-dev mailing list