Fixes #10836
Error message I would get on make
:
0...
1 CXXLD bench/bench_bitcoin.exe
2 OBJCXXLD qt/bitcoin-qt.exe
3qt/test/test_main.cpp: In function ‘int main(int, char**)’:
4qt/test/test_main.cpp:64:43: error: ‘setenv’ was not declared in this scope
5 setenv("QT_QPA_PLATFORM", "minimal", 0);
6 ^
7make[2]: *** [qt/test/qt_test_test_bitcoin_qt-test_main.o] Error 1
8make[2]: *** Waiting for unfinished jobs....
9make[2]: Leaving directory `/home/bmcmichael/Projects/bcoin/src'
10make[1]: *** [all-recursive] Error 1
11make[1]: Leaving directory `/home/bmcmichael/Projects/bcoin/src'
12make: *** [all-recursive] Error 1
setenv
function is not available from the Microsoft runtime library. Need to use _putenv_s
instead.
This solution tells the compiler to use _putenv_s
on WIN32
compilation (Note: this also works on 64-bit Windows instances.) and setenv
everywhere else.
I’ve tested builds on Windows 10 x64 and Ubuntu 16.04 with this code.