:: Re: [Libbitcoin] examples/main.cpp…
Page principale
Supprimer ce message
Répondre à ce message
Auteur: mlmikael
Date:  
À: Eric Voskuil
CC: libbitcoin
Anciens-sujets: 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!)
Sujet: 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!)
Dear Eric,

This error has been reintroduced in the "version2" repo, in the
currenetly latest commit which is
https://github.com/libbitcoin/libbitcoin/blob/e3a2f8213c939adead02923fdca6f891975632d4/examples/main.cpp
.

I.e. kindly remove the four lines 45-48?

At least doing that makes compilation work.

Thanks!

On 2015-07-20 08:13, Eric Voskuil wrote:
> 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.
>>