cpxfiddle.cc:1857:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]

681 ワード

Dorisのsar_toolsはmakeタイムズで次のように間違っています.
g++ -O3 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE  -D_LARGEFILE64_SOURCE  -c -o cpxfiddle.o cpxfiddle.cc
cpxfiddle.cc: In function ‘bool handleinput(int, char**, commandlineinput&)’:
cpxfiddle.cc:1857:21: error: ISO C++ forbids comparison between pointer and integer [-fpermissive]
   if (argv[optind]=='\0')
                     ^~~~
Makefile:161: recipe for target 'cpxfiddle.o' failed
make: *** [cpxfiddle.o] Error 1

なぜなら、4行目のif文のargv[optind]と'0'は直接比較できず、if (*argv[optind]=='\0')またはif (argv[optind]==0 || argv[optind][0]=='\0')に変更できるからです.