Why is GSL-Lite trying to include <array>?

186 Views Asked by At

I'm trying to use a gsl inside my embedded STM32 Keil project. My Keil project uses an outdated semi c++11 compiler at most. (It is a constraint put on me by my ST library for LoRaWAN). I'm using the V5.06 update 6 (build 750) ARM Compiler bundled by keil. Keil has chosen not to implement the std::aray of the STL. I'm very disappointed about this but hey wat can I do.

I've chosen to use the gsl-Lite. It is supposed to be C++98 and C++03 compatible. So no std::array needed, but when I try to compile my code with the library included in my include path I get this build message:

..\Core\inc\gsl/gsl-lite.hpp(405): error: #5: cannot open source input file "array": No such file or directory
# include <array>

But line 404 starts with this piece of code:

#if gsl_HAVE( ARRAY )
# include <array>
#endif

Seems to me that they are trying to determine if <array> can be included. My editor greys this block out as if it hasn't been defined.

gsl_HAVE is defined as:

#define gsl_HAVE(             feature )  ( gsl_HAVE_##feature )

I don't understand how this work and how I can check if ARRAY was properly not defined.

I wan't to not include <array> so my code can build and use the gsl-lite. My preferred option is something with a define.

update

As far as I understand the include system:

#define gsl_HAVE_ARRAY                  gsl_CPP11_110

Is defined to automatically exclude a feature (gsl_HAVE_ARRAY in this case) when

#define gsl_CPP11_OR_GREATER  ( gsl_CPLUSPLUS >= 201103L )

Is evaluated to be true. gsl_CPLUSPLUS is defined as

#  define gsl_CPLUSPLUS  __cplusplus

But I can't seem to figure out the value of __cplusplus.

1

There are 1 best solutions below

0
Tarick Welling On

I think my problem is that _cplusplus holds no value because keil doesn't add it. Even when I declared gsl_CPLUSPLUS as 199711L it didn't work because the compiler couldn't delete a gsl::owner<int *> because it is expecting a bare pointer.

It seems like that the compiler just is too old to handle the gsl.