PotreeConverter
PotreeConverter copied to clipboard
Build failure with g++ 9.4.0
When running make, I get the following error:
In file included from /home/dllu/proj/PotreeConverter/Converter/src/main.cpp:9:
/home/dllu/proj/PotreeConverter/./Converter/include/sampler_poisson.h:100:31: error: non-constant-expression cannot be narrowed from type 'int64_t' (aka 'long') to 'int32_t' (aka 'int') in initializer list [-Wc++11-narrowing]
Point point = { x, y, z, i, childIndex };
^
/home/dllu/proj/PotreeConverter/./Converter/include/sampler_poisson.h:100:31: note: insert an explicit cast to silence this issue
Point point = { x, y, z, i, childIndex };
^
static_cast<int32_t>( )
/home/dllu/proj/PotreeConverter/./Converter/include/sampler_poisson.h:100:34: error: non-constant-expression cannot be narrowed from type 'int64_t' (aka 'long') to 'int32_t' (aka 'int') in initializer list [-Wc++11-narrowing]
Point point = { x, y, z, i, childIndex };
^~~~~~~~~~
/home/dllu/proj/PotreeConverter/./Converter/include/sampler_poisson.h:100:34: note: insert an explicit cast to silence this issue
Point point = { x, y, z, i, childIndex };
^~~~~~~~~~
static_cast<int32_t>( )
However, I fixed it with the following diff:
diff --git a/Converter/include/sampler_poisson.h b/Converter/include/sampler_poisson.h
index ddf1474..a0c6f34 100644
--- a/Converter/include/sampler_poisson.h
+++ b/Converter/include/sampler_poisson.h
@@ -97,7 +97,7 @@ struct SamplerPoisson : public Sampler {
double y = (xyz[1] * scale.y) + offset.y;
double z = (xyz[2] * scale.z) + offset.z;
- Point point = { x, y, z, i, childIndex };
+ Point point = { x, y, z, static_cast<int32_t>(i), static_cast<int32_t>(childIndex) };
points.push_back(point);
}