mtholder / ncl

Nexus Class Library
GNU General Public License v2.0
8 stars 16 forks source link

compilation issue with windows #5

Open fmichonneau opened 9 years ago

fmichonneau commented 9 years ago

These lines: https://github.com/mtholder/ncl/blob/master/ncl/nxstaxablock.cpp#L278-280

are causing issue when compiling NCL under windows (specifically using the winbuilder tool for R packages):

g++ -m64 -I"D:/RCompile/recent/R/include"            -I"d:/RCompile/CRANpkg/lib/3.2/Rcpp/include" -I"d:/Rcompile/CRANpkg/extralibs215/local215/include"  -I. -DHAVE_INTTYPES_H -DASSERTS_TO_EXCEPTIONS   -O3 -Wall  -mtune=core2            -c nxstaxablock.cpp -o nxstaxablock.o
nxstaxablock.cpp: In member function 'void NxsTaxaBlock::CheckCapitalizedTaxonLabel(const string&) const':
nxstaxablock.cpp:279:54: error: ambiguous overload for 'operator<<' in 'e.NxsString::operator<<(((const char*)"Number of stored labels (")) << ((const NxsTaxaBlock*)this)->NxsTaxaBlock::taxLabels.std::vector<_Tp, _Alloc>::size [with _Tp = NxsString, _Alloc = std::allocator<NxsString>, std::vector<_Tp, _Alloc>::size_type = long long unsigned int]()'
nxstaxablock.cpp:279:54: note: candidates are:
./ncl/nxsstring.h:617:19: note: NxsString& NxsString::operator<<(int)
./ncl/nxsstring.h:626:19: note: NxsString& NxsString::operator<<(unsigned int)
./ncl/nxsstring.h:635:19: note: NxsString& NxsString::operator<<(long int)
./ncl/nxsstring.h:644:19: note: NxsString& NxsString::operator<<(long unsigned int)
./ncl/nxsstring.h:653:19: note: NxsString& NxsString::operator<<(double)
./ncl/nxsstring.h:662:19: note: NxsString& NxsString::operator<<(const char*) <near match>
./ncl/nxsstring.h:662:19: note:   no known conversion for argument 1 from 'std::vector<NxsString>::size_type {aka long long unsigned int}' to 'const char*'
./ncl/nxsstring.h:671:19: note: NxsString& NxsString::operator<<(char)
./ncl/nxsstring.h:680:19: note: NxsString& NxsString::operator<<(const string&) <near match>
./ncl/nxsstring.h:680:19: note:   no known conversion for argument 1 from 'std::vector<NxsString>::size_type {aka long long unsigned int}' to 'const string& {aka const std::basic_string<char>&}'
make: *** [nxstaxablock.o] Error 1
mtholder commented 9 years ago

hmm. that looks ominous (in the sense that defeating the error might lead you to encounter several similar ones; it looks like this compiler is quite picky...

I'd suggest an explicit cast:

e << "Number of stored labels (" << (long unsigned int) taxLabels.size() << ") exceeds the NTax specified (" << dimNTax<<").";