I am trying to run the code in repository Link.
Here, is the Google Colab link which installs all the libraries as required to run the repository. - Link
In the link, there are two ways I have built the project. One is using qmake and the other is using cmake. Both of them give me the same errors.
I searched for the error in question but gave me some answers that were 7 years old. Considering the code in the repository is built in 2020, I doubt there is a problem in the code. I think the problem may be with the version of gcc/g .
Version:
GCC/G : 7.5.
The code that throws the error:
#define len(p) (std::sqrt(p.x * p.x p.y * p.y))
The above code is present in src/geomutils.h line 31.
Does this code follow some specific C version like C -11, C -14, etc.?
CodePudding user response:
You defined a proprocessor macro named len()
. We can tell from the GCC error message that the file /usr/include/mlpack/core/data/serialization_shim.hpp
contains the code len(len)
inside it, which is presumably intended to initialize the len
member of a class. But the preprocessor is inserting your code there and causing syntax errors.
Rename len
to something less likely to be used in other code, or make sure you only define it after including all third-party header files.