vendredi 3 novembre 2017

LLONG_MAX missing for g++ 4.9.4?

I was trying to debug big this simple code:

#include "limits.h"

int main()
{
  long long a = LLONG_MAX;

  return 0;
}

If I run it just like

g++ test.c

I get

test.cpp: In function ‘main’:
test.cpp:5:17: error: ‘LLONG_MAX’ undeclared (first use in this function)
long long a = LLONG_MAX;

I checked the reference for this constant, which says:

LLONG_MIN, LLONG_MAX and ULLONG_MAX are defined for libraries complying with the 
C standard of 1999 or later (which only includes the C++ standard since 2011: C++11).

so I tried setting -std=c++11 but didn't help. Any suggestions?

P.S same code compiles fine on other machines with g++ 5.4.0

Aucun commentaire:

Enregistrer un commentaire