:: Re: [Libbitcoin] examples/main.cpp:…
Startseite
Nachricht löschen
Nachricht beantworten
Autor: Eric Voskuil
Datum:  
To: mlmikael, libbitcoin
Neue Treads: Re: [Libbitcoin] examples/main.cpp:43 uses "environ" which does not exist at least on OBSD 5.7/GCC 4.8.4. Fix? (Just commenting out the four affected lines solves it at least locally!)
Betreff: Re: [Libbitcoin] examples/main.cpp:43 uses "environ" which does not exist at least on OBSD 5.7/GCC 4.8.4. Fix? (Just commenting out the four affected lines solves it at least locally!)
Thanks. Just missing an include for non-windows/osx. Fixed in master.
This code is just some manual evaluation/demo I was doing while
verifying our utf8anywhere implementation.

e

On 07/19/2015 08:01 AM, mlmikael wrote:
> Eric,
>
> https://github.com/libbitcoin/libbitcoin/blob/version2/ has some checks
> for __MACH__
>
>      $ grep -r __MACH__ *
>      examples/main.cpp:#ifndef __MACH__
>      include/bitcoin/bitcoin/utility/time.hpp:#if defined(__MACH__)
>      include/bitcoin/bitcoin/utility/time.hpp:#if defined(__MACH__)
>      src/utility/time.cpp:#if defined(__MACH__)
>      src/utility/time.cpp:#if defined(__MACH__)

>
> . Looks like this is a Mac OS X check,
> http://stackoverflow.com/questions/2166483/which-macro-to-wrap-mac-os-x-specific-code-in-c-c
> .
>
> __MACH__ is indeed not defined on OpenBSD (5.7, eg++ (GCC) 4.8.4), and
> for that reason compilation of the lines in examples/main.cpp :
>
>      #ifndef __MACH__
>          if (environ[0] != nullptr)
>              bc::cout << "environ[0] : " << environ[0] << std::endl;
>      #endif

>
> fail the compilation with error:
>
>      examples/main.cpp: In function 'int libbitcoin::main(int, char**)':
>      examples/main.cpp:43:9: error: 'environ' was not declared in this
> scope
>           if (environ[0] != nullptr)
>          ^

>
> .
>
> Can you please fix that?
>
>
> Just commenting out the four lines altogether seems to resolve it at
> least locally.
>
> (The other __MACH__ ifdefs in the code caused no issue though.)
>
> Thanks.
>