FTBFS: INT64_MIN not defined. #637

issue thisisnotmyrealemail opened this issue on November 16, 2011
  1. thisisnotmyrealemail commented at 7:07 AM on November 16, 2011: none

    I get errors from net.cpp and other modules (see below) about INT64_MIN and other constants not being defined. Including <inttypes.h>, <stdint.h>, or <limits.h> doesn't help, and neither does #defining __STDC_LIMIT_MACROS. These headers seem to work differently in C++ from C.

    To make the modules compile, I had to write a header that #defines these constants in terms of the C++ numeric_limits template:

    <pre> #ifndef CPPLIMITS_H #define CPPLIMITS_H #include &lt;limits&gt; #include &lt;inttypes.h&gt; #define INT64_MAX std::numeric_limits&lt;int64&gt;::max() #define INT64_MIN std::numeric_limits&lt;int64&gt;::min() #define UINT64_MIN std::numeric_limits&lt;uint64&gt;::min() #define UINT64_MAX std::numeric_limits&lt;uint64&gt;::max() #endif </pre>

    The following source files needed to include this header:

    <ul> <li> net.cpp</li> <li> wallet.cpp</li> <li> util.cpp</li> </ul>

  2. gavinandresen commented at 1:13 AM on November 22, 2011: contributor

    Related: #645

  3. laanwj commented at 7:12 PM on November 24, 2011: member

    According to a quick google, INT64_MIN should be defined in <stdint.h>. I checked on my own system and this seems to be the case:

    $ grep INT64_MIN /usr/include/stdint.h 
    # define INT64_MIN      (-__INT64_C(9223372036854775807)-1)
    

    What OS/compiler is this? Can you look in your stdint.h to see whether it is defined but guarded for some reason? Or not defined there at all?

  4. thisisnotmyrealemail commented at 6:45 AM on November 28, 2011: none

    OS/Compiler is Debian Lenny and GCC 4.3.2.

    INT64_MIN and related constants from /usr/include/stdint.h are guarded with:

    <code>#if !defined __cplusplus || defined __STDC_LIMIT_MACROS</code>

    The guard also appears on Debian Sid with GCC 4.6.1.

    __STDC_LIMIT_MACROS must be defined before the <i>first</i> inclusion of &lt;stdint.h&gt;, which in the Bitcoin code occurs indirectly through Boost.

  5. gavinandresen commented at 9:39 PM on February 23, 2012: contributor

    Latest code doesn't use INT64_anything (it uses std::numeric_limits<> instead).

  6. gavinandresen closed this on Feb 23, 2012

  7. ptschip referenced this in commit ba845cdede on Jun 3, 2017
  8. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-17 18:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me