Skip to content

The name I is reserved by complex.h, causing problems in the community #62

Description

@JeffreyBroll

I've run into issues with a few Lgm functions using a parameter name I, which leads to inscrutable build failures like the attached (abridged for so many reasons). Since C99 this has been #defined in complex.h to expand to an imaginary unit. The two fixes that come to mind - renaming quite a lot of things or counter-#defining around the complex.h I - are both pretty gross, but anything importing complex.h (e.g. LAPACKE) gets more gross.

JB


Abridged build error:


   85 | Lgm_DFI_RBF_Info *Lgm_DFI_RBF_Init( unsigned long int *I, Lgm_Vector *v, Lgm_Vector *B, int n, double eps, int RadialBasisFunction );
      |                                                        ^

In file included from ... include/Lgm/Lgm_MagModelInfo.h:10,
                 from include/Lgm/Lgm_MagEphemInfo.h:4,
                 from /other/things/snipped:

include/Lgm/Lgm_RBF.h:85:59: error: expected ‘;’, ‘,’ or ‘)’ before ‘Lgm_Vector’

   85 | Lgm_DFI_RBF_Info *Lgm_DFI_RBF_Init( unsigned long int *I, Lgm_Vector *v, Lgm_Vector *B, int n, double eps, int RadialBasisFunction );
      |                                                           ^~~~~~~~~~

include/Lgm/Lgm_MagModelInfo.h:846:38: error: expected ‘)’ before ‘__extension__’

  846 | double      LFromIBmM_Hilton( double I, double Bm, double M );
      |                                      ^

include/Lgm/Lgm_MagModelInfo.h:846:41: error: expected ‘;’, ‘,’ or ‘)’ before ‘double’

  846 | double      LFromIBmM_Hilton( double I, double Bm, double M );
      |                                         ^~~~~~

include/Lgm/Lgm_MagModelInfo.h:848:40: error: expected ‘)’ before ‘__extension__’

  848 | double      LFromIBmM_McIlwain( double I, double Bm, double M );
      |                                        ^

include/Lgm/Lgm_MagModelInfo.h:848:43: error: expected ‘;’, ‘,’ or ‘)’ before ‘double’

  848 | double      LFromIBmM_McIlwain( double I, double Bm, double M );
      |                                           ^~~~~~

include/Lgm/Lgm_MagModelInfo.h:850:103: error: expected ‘)’ before ‘__extension__’

  850 | double      Lgm_McIlwain_L( long int Date, double UTC, Lgm_Vector *u, double Alpha, int Type, double *I, double *Bm, double *M, Lgm_MagModelInfo *mInfo );
      |                                                                                                       ^

include/Lgm/Lgm_MagModelInfo.h:850:106: error: expected ‘;’, ‘,’ or ‘)’ before ‘double’

  850 | double      Lgm_McIlwain_L( long int Date, double UTC, Lgm_Vector *u, double Alpha, int Type, double *I, double *Bm, double *M, Lgm_MagModelInfo *mInfo );
      |                                                                                                          ^~~~~~

include/Lgm/Lgm_LstarInfo.h:104:25: error: expected identifier or ‘(’ before ‘__extension__’

  104 |     double              I[ LGM_LSTARINFO_MAX_FL ];
      |                         ^

include/Lgm/Lgm_MagEphemInfo.h:92:18: error: expected identifier or ‘(’ before ‘__extension__’

   92 |     double      *I;         //!< 1D array (dynamically allocated). Access as follows: I[ PitchAngleIndex ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions