src-d / kmcuda

Large scale K-means and K-nn implementation on NVIDIA GPU / CUDA
Other
807 stars 146 forks source link

Error: spurious trailing ‘%’ in format #37

Closed yuxincs closed 6 years ago

yuxincs commented 6 years ago

I encountered this problem when compiling with gcc 5.3.0 and cuda 8.0.

/home/kmcuda/src/python.cc: In function ‘bool validate_features_size(uint32_t)’:
/home/kmcuda/src/python.cc:108:45: error: expected ‘)’ before ‘PRIu32’:
     sprintf(msg, "\"samples\": more than %" PRIu32 " features is not supported",
                                             ^~~~~~
/home/kmcuda/src/python.cc:109:26: error: spurious trailing ‘%’ in format [-Werror=format=]

This page explains why and by adding #define __STDC_FORMAT_MACROS at the begining of python.cc file I can compile successfully.

Also I tried gcc 6.3.0 and cuda 9.0 this problem still exists.

vmarkovtsev commented 6 years ago

I see, thanks for reporting. Will be happy to merge your PR; otherwise, I'll fix myself in a few days.