Compilation error using gcc-strprintf ("%" PRId64, n)

I am trying to compile some code from Github on my (updated), Centos 6.5 using GCC ++.
But I am getting below error when I try to compile the code.

Below is the line with the error:

...
#define __STDC_FORMAT_MACROS 1

...
#include <inttypes.h>

...
inline std::string i64tostr(int64_t n)
{
  return strprintf("%"PRId64, n);   // <-- errors here.
}

...

      

And the error:

error: expected ')' before 'PRId64

      

What could be the problem and how to solve it?

Edit 1: This is the error line of the code.
https://github.com/rat4/blackcoin/blob/master/src/util.h#L226

Edit 2: by replacing the code printf ("%" PRId64, n); (note the extra space) as suggested in the suggested answer does not work (the same error message is stated).

+3


source to share


1 answer


It seems that the error is somewhere external. Have a look - http://ideone.com/dqeMTY - I copied your code, but I was wrong and missed #

before define __STDC_FORMAT_MACROS 1

, and ... I have the same error about PRId64

. Try commenting out half of the code to the suspicious line, then another half, etc.



0


source







All Articles