When compiling tor I get the following error in torint.h...
src\tor\torint.h:190: error: invalid suffix "i64" on integer constant
#define INT64_MAX 0x7fffffffffffffffi64
^
specifically on the line below.
https://github.com/arlolra/tor/blob/master/src/common/torint.h#L190
The code linked above is the second line in the code below...
#ifndef INT64_MAX
#define INT64_MAX 0x7fffffffffffffffi64
#endif
I am building on Windows 7 64-bit with MingW32 using gcc 4.8.2. The full output for gcc -v is below. I have read that this could be an environment problem but am unable to find a solution. Any advice on how to resolve this would be appreciated.
gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=c:/mingw32/bin/../libexec/gcc/i686-w64-mingw32/4.8.2/lto-wra
pper.exe
Target: i686-w64-mingw32
Configured with: ../../../src/gcc-4.8.2/configure --host=i686-w64-mingw32 --buil
d=i686-w64-mingw32 --target=i686-w64-mingw32 --prefix=/mingw32 --with-sysroot=/c
/mingw482/i686-482-posix-dwarf-rt_v3-r2/mingw32 --with-gxx-include-dir=/mingw32/
i686-w64-mingw32/include/c++ --enable-shared --enable-static --disable-multilib
--enable-languages=ada,c,c++,fortran,objc,obj-c++,lto --enable-libstdcxx-time=ye
s --enable-threads=posix --enable-libgomp --enable-lto --enable-graphite --enabl
e-checking=release --enable-fully-dynamic-string --enable-version-specific-runti
me-libs --disable-sjlj-exceptions --with-dwarf2 --disable-isl-version-check --di
sable-cloog-version-check --disable-libstdcxx-pch --disable-libstdcxx-debug --en
able-bootstrap --disable-rpath --disable-win32-registry --disable-nls --disable-
werror --disable-symvers --with-gnu-as --with-gnu-ld --with-arch=i686 --with-tun
e=generic --with-libiconv --with-system-zlib --with-gmp=/c/mingw482/prerequisite
s/i686-w64-mingw32-static --with-mpfr=/c/mingw482/prerequisites/i686-w64-mingw32
-static --with-mpc=/c/mingw482/prerequisites/i686-w64-mingw32-static --with-isl=
/c/mingw482/prerequisites/i686-w64-mingw32-static --with-cloog=/c/mingw482/prere
quisites/i686-w64-mingw32-static --enable-cloog-backend=isl --with-pkgversion='i
686-posix-dwarf, Built by MinGW-W64 project' --with-bugurl=http://sourceforge.ne
t/projects/mingw-w64 CFLAGS='-O2 -pipe -I/c/mingw482/i686-482-posix-dwarf-rt_v3-
r2/mingw32/opt/include -I/c/mingw482/prerequisites/i686-zlib-static/include -I/c
/mingw482/prerequisites/i686-w64-mingw32-static/include' CXXFLAGS='-O2 -pipe -I/
c/mingw482/i686-482-posix-dwarf-rt_v3-r2/mingw32/opt/include -I/c/mingw482/prere
quisites/i686-zlib-static/include -I/c/mingw482/prerequisites/i686-w64-mingw32-s
tatic/include' CPPFLAGS= LDFLAGS='-pipe -L/c/mingw482/i686-482-posix-dwarf-rt_v3
-r2/mingw32/opt/lib -L/c/mingw482/prerequisites/i686-zlib-static/lib -L/c/mingw4
82/prerequisites/i686-w64-mingw32-static/lib -Wl,--large-address-aware'
Thread model: posix
gcc version 4.8.2 (i686-posix-dwarf, Built by MinGW-W64 project)
i64
is not a standard integer literal suffix, so this must be a compiler extension. The draft C++ standard in section 2.14.2
Integer literals defines the following integer literal suffixes:
integer-suffix:
unsigned-suffix long-suffixopt
unsigned-suffix long-long-suffixopt
long-suffix unsigned-suffixopt
long-long-suffix unsigned-suffixopt
unsigned-suffix: one of
u U
long-suffix: one of
l L
long-long-suffix: one of
ll LL
we can see that Microsoft does allow such a suffix in C++ from their C++ Integer Constants page.
The correct suffix for gcc
should be ll
based on the source you linked to but this requires SIZEOF_LONG_LONG == 8.
As Keith points out using the LL
suffix is probably better than using ll
since it is equivalent and ll
it could easily be mistaken for 11
(one one) or even mis-typed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With