Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Support #ATY-776694]: [udunits] Compiler-Error in udunits2 with compatibility include-file of udunits



Heiko,

> I tried to compile a c++-program which uses the old udunits package
> against the new udunits2 package with the compatible udunits.h.
> 
> I got the following compiler error with gcc 4.1.2 (Debian 32bit):
> 
> /usr/local/include/udunits.h:57: error: declaration of 'ut_unit*
> utUnit::ut_unit'
> /usr/local/include/udunits2.h:17: error: changes meaning of 'ut_unit'
> from 'typedef union ut_unit ut_unit'
> 
> 
> The following program compiles nicely with gcc, but fails with above
> error with g++:
> 
> #include <udunits.h>
> int main(int argc, char* args[]) {
> }

What happens if you move the definition of the "utUnit" typedef in "udunits.h" 
from before the "#ifdef __cplusplus" to after it, i.e., in the file 
"udunits.h", change

    /*  
     *  Unit-structure.  Don't rely on or mess with the members!
     */ 
    typedef struct utUnit { 
        ut_unit*            ut_unit;
    } utUnit;
    
    #ifdef __cplusplus
    extern "C" {
    #endif

to
    
    #ifdef __cplusplus
    extern "C" {
    #endif

    /*  
     *  Unit-structure.  Don't rely on or mess with the members!
     */ 
    typedef struct utUnit { 
        ut_unit*            ut_unit;
    } utUnit;

> Best regards,
> 
> Heiko
> 
> --
> Dr. Heiko Klein                              Tel. + 47 22 96 32 58
> Development Section / IT Department          Fax. + 47 22 69 63 55
> Norwegian Meteorological Institute           http://www.met.no
> P.O. Box 43 Blindern  0313 Oslo NORWAY
> 
> _______________________________________________
> udunits mailing list
> udunits@xxxxxxxxxxxxxxxx
> For list information, to unsubscribe, or change your membership options, 
> visit: http://www.unidata.ucar.edu/mailing_lists/

Regards,
Steve Emmerson

Ticket Details
===================
Ticket ID: ATY-776694
Department: Support UDUNITS
Priority: Normal
Status: Closed


 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690