williamslab / ibis

Algorithm for rapid, phase-free detection of long identical by descent segments
GNU General Public License v3.0
17 stars 7 forks source link

Compilation errors: error: 'exit' was not declared in this scope #14

Closed bredeson closed 6 months ago

bredeson commented 7 months ago

Hi! I just learned about this software and am excited to try it on my dataset; however, I'm getting compilation errors when I run make on a SuseLinux-based operating system and GCC 12.2.0. Looking at seg2coef.cc, the cstdlib library isn't being #included

make
g++ -MMD -std=c++2a -I. -Wall  -fopenmp -mpopcnt -O3 -o IBIS.o -c IBIS.cc
g++ -MMD -std=c++2a -I. -Wall  -fopenmp -mpopcnt -O3 -o genetio/personio.o -c genetio/personio.cc
g++ -MMD -std=c++2a -I. -Wall  -fopenmp -mpopcnt -O3 -o genetio/marker.o -c genetio/marker.cc
g++ -MMD -std=c++2a -I. -Wall  -fopenmp -mpopcnt -O3 -o genetio/superperson.o -c genetio/superperson.cc
g++ -MMD -std=c++2a -I. -Wall  -fopenmp -mpopcnt -O3 -o genetio/personloopdata.o -c genetio/personloopdata.cc
g++ -MMD -std=c++2a -I. -Wall  -fopenmp -mpopcnt -O3 -o genetio/personbulk.o -c genetio/personbulk.cc
g++ -MMD -std=c++2a -I. -Wall  -fopenmp -mpopcnt -O3 -o genetio/nuclearfamily.o -c genetio/nuclearfamily.cc
g++ -MMD -std=c++2a -I. -Wall  -fopenmp -mpopcnt -O3 -o genetio/util.o -c genetio/util.cc
g++ -o ibis IBIS.o genetio/personio.o genetio/marker.o genetio/superperson.o genetio/personloopdata.o genetio/personbulk.o genetio/nuclearfamily.o genetio/util.o  -I. -Wall  -fopenmp -mpopcnt -O3 -lz
g++ -std=c++2a -I. -Wall  -fopenmp -mpopcnt -O3 -o bseg2seg bseg2seg.cc
g++ -std=c++2a -I. -Wall  -fopenmp -mpopcnt -O3 -o seg2coef seg2coef.cc
seg2coef.cc: In function 'int main(int, char**)':
seg2coef.cc:70:5: error: 'exit' was not declared in this scope
   70 |     exit(1);
      |     ^~~~
seg2coef.cc:8:1: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
    7 | #include <vector>
  +++ |+#include <cstdlib>
    8 | #include <tuple>
seg2coef.cc:75:21: error: 'strtof' was not declared in this scope; did you mean 'strtok'?
   75 |   float mapLength = strtof(mapLengthStr, &endptr);
      |                     ^~~~~~
      |                     strtok
seg2coef.cc:84:5: error: 'exit' was not declared in this scope
   84 |     exit(6);
      |     ^~~~
seg2coef.cc:84:5: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
seg2coef.cc:100:27: error: 'malloc' was not declared in this scope
  100 |   char *buffer = (char *) malloc(bytesRead + 1);
      |                           ^~~~~~
seg2coef.cc:100:27: note: 'malloc' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
seg2coef.cc:103:5: error: 'exit' was not declared in this scope
  103 |     exit(5);
      |     ^~~~
seg2coef.cc:103:5: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
seg2coef.cc: In function 'uint64_t readSeg(FILE*, char*, char*, size_t&, bool&, char*, SampIdIdx&, std::unordered_map<int, std::tuple<int, float, float> >*&)':
seg2coef.cc:237:9: error: 'exit' was not declared in this scope
  237 |         exit(3);
      |         ^~~~
seg2coef.cc:237:9: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
seg2coef.cc:261:7: error: 'exit' was not declared in this scope
  261 |       exit(2);
      |       ^~~~
seg2coef.cc:261:7: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
seg2coef.cc:265:25: error: 'strtof' was not declared in this scope; did you mean 'strtok'?
  265 |     float genetLength = strtof(genetLengthStr, &endptr);
      |                         ^~~~~~
      |                         strtok
seg2coef.cc:273:7: error: 'exit' was not declared in this scope
  273 |       exit(6);
      |       ^~~~
seg2coef.cc:273:7: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
seg2coef.cc: In function 'uint64_t readBseg(FILE*, char*, bool&, char*, SampIdIdx&, std::unordered_map<int, std::tuple<int, float, float> >*&)':
seg2coef.cc:297:5: error: 'exit' was not declared in this scope
  297 |     exit(5);
      |     ^~~~
seg2coef.cc:297:5: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
seg2coef.cc:306:5: error: 'exit' was not declared in this scope
  306 |     exit(5);
      |     ^~~~
seg2coef.cc:306:5: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
seg2coef.cc:317:5: error: 'exit' was not declared in this scope
  317 |     exit(5);
      |     ^~~~
seg2coef.cc:317:5: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
seg2coef.cc:361:7: error: 'exit' was not declared in this scope
  361 |       exit(5);
      |       ^~~~
seg2coef.cc:361:7: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
seg2coef.cc: In function 'void readFam(SampIdIdx&, char*, bool)':
seg2coef.cc:379:27: error: 'malloc' was not declared in this scope
  379 |   char *buffer = (char *) malloc(bytesRead + 1);
      |                           ^~~~~~
seg2coef.cc:379:27: note: 'malloc' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
seg2coef.cc:382:5: error: 'exit' was not declared in this scope
  382 |     exit(5);
      |     ^~~~
seg2coef.cc:382:5: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
seg2coef.cc:390:5: error: 'exit' was not declared in this scope
  390 |     exit(5);
      |     ^~~~
seg2coef.cc:390:5: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
seg2coef.cc:408:9: error: 'exit' was not declared in this scope
  408 |         exit(1);
      |         ^~~~
seg2coef.cc:408:9: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
seg2coef.cc:417:7: error: 'exit' was not declared in this scope
  417 |       exit(1);
      |       ^~~~
seg2coef.cc:417:7: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
seg2coef.cc:435:7: error: 'exit' was not declared in this scope
  435 |       exit(2);
      |       ^~~~
seg2coef.cc:435:7: note: 'exit' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
seg2coef.cc:444:3: error: 'free' was not declared in this scope
  444 |   free(buffer);
      |   ^~~~
seg2coef.cc:444:3: note: 'free' is defined in header '<cstdlib>'; did you forget to '#include <cstdlib>'?
make: *** [Makefile:57: seg2coef] Error 1

Best, Jessen

williamslab commented 6 months ago

Thanks for this! I just pushed a version of seg2coef.cc that includes stdlib.h. Please let me know if this does not resolve your issue. Since it looks like this will be sufficient, I'll close this for now.