shendurelab / LACHESIS

The LACHESIS software, as described in Nature Biotechnology (http://dx.doi.org/10.1038/nbt.2727)
Other
76 stars 32 forks source link

compile fail int64_t declaration without type. #67

Open molikd opened 3 years ago

molikd commented 3 years ago

Hello.

It looks like you might be trying to instantiate a int64_t without a type in N50.cc?

Apparently this causes g++ compiler problems.

Test environment is Alpine.

/shendurelab-LACHESIS-2e27abb # make 
Making all in src/include/gtools
make[1]: Entering directory '/shendurelab-LACHESIS-2e27abb/src/include/gtools'
Makefile:476: warning: ignoring prerequisites on suffix rule definition
g++ -c N50.cc -Wall -ansi -pedantic -g -O3 -std=c++11 
N50.cc:32:10: error: ISO C++ forbids declaration of 'int64_t' with no type [-fpermissive]
   32 | template int64_t N50( const vector<int64_t> & v );
      |          ^~~~~~~
N50.cc:32:10: error: 'int64_t' is not a template function
N50.cc:32:17: error: expected ';' before 'N50'
   32 | template int64_t N50( const vector<int64_t> & v );
      |                 ^~~~
      |                 ;
N50.cc: In function 'T N50(const std::vector<T>&)':
N50.cc:45:3: error: 'int64_t' was not declared in this scope
   45 |   int64_t sum = accumulate( v.begin(), v.end(), (int64_t) 0 );
      |   ^~~~~~~
N50.cc:46:10: error: expected ';' before 'half'
   46 |   int64_t half = 0;
      |          ^~~~~
      |          ;
N50.cc:54:5: error: 'half' was not declared in this scope
   54 |     half += sorted_v[i];
      |     ^~~~
N50.cc:55:22: error: 'sum' was not declared in this scope
   55 |     if ( 2 * half == sum && i < sorted_v.size() - 1 )
      |                      ^~~
N50.cc:57:22: error: 'sum' was not declared in this scope
   57 |     if ( 2 * half >= sum ) return sorted_v[i];
      |                      ^~~
make[1]: *** [Makefile:476: N50.o] Error 1
make[1]: Leaving directory '/shendurelab-LACHESIS-2e27abb/src/include/gtools'
make: *** [Makefile:402: all-recursive] Error 1
molikd commented 3 years ago

I should point out that this can be fixed by adding #include <stdint.h>