JohnAgapeyev / ChessPlusPlus

C++14 Chess AI
GNU General Public License v3.0
0 stars 0 forks source link

make error: 'putenv' was not declared in this scope. #1

Open Chun-YIp opened 7 years ago

Chun-YIp commented 7 years ago

Fully pulled then, using cygwin with correct packages installed to compile, Got an error:

g++ -c -Wall -pedantic -pipe -std=c++14 -fopenmp -s -O3 -march=native -flto -ftracer -funswitch-loops -funroll-loops -funit-at-a-time -fno-rtti -fno-exceptions -fomit-frame-pointer -DNDEBUG src/ChessPlusPlus.cpp -o bin/ChessPlusPlus.o src/ChessPlusPlus.cpp: In function ‘int main(int, char)’: src/ChessPlusPlus.cpp:32:47: error: ‘putenv’ was not declared in this scope putenv((char )"OMP_CANCELLATION=true"); ^ make: [makefile:51: bin/ChessPlusPlus.o] Error 1

Chun-YIp commented 7 years ago

btw, Hi John

JohnAgapeyev commented 7 years ago

The chess AI was limited to Linux for exactly that reason I needed to define an environment variable to enable thread cancellation, but there wasn't an easy way to do it Try it on Linux, or if that's not an option, try adding the following as the first line in ChessPlusPlus.cpp #define _XOPEN_SOURCE You can also pass -D_XOPEN_SOURCE as a compile flag to define it at compile time That macro might enable a function prototype in Cygwin's glibc implementation that might work Worst case, comment out that line and instead of running the AI as ./chess run it as OMP_CANELLATION=true ./chess That should define it in the command line before the program is ran Hope that works for you

JohnAgapeyev commented 7 years ago

Also hi chun