Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile fail int64_t declaration without type. #67

Open
molikd opened this issue Jun 14, 2021 · 1 comment
Open

compile fail int64_t declaration without type. #67

molikd opened this issue Jun 14, 2021 · 1 comment

Comments

@molikd
Copy link

molikd commented Jun 14, 2021

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
Copy link
Author

molikd commented Jun 14, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant