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
Compilation error with MSYS2 mingw-w64, 'M_PI' was not defined in this scope #3679
Comments
I think mingw is simply broken due to assumption of msvc. Since it seems you are using MinGW, could you please help to improve the support on CI? That'd be a nice help apart from PR to resolve the issues. |
What assumption of MSVC do you mean? That Windows == MSVC? I have no experience with CI unfortunately. |
Regarding your fix idea, we already have that define in pcl/common/include/pcl/pcl_macros.h Lines 58 to 59 in b1d9c7e
Regarding |
Yeah. We compile and test on Windows using only MSVC
No, I tested and PCL definitely uses
It's not a big issue. I'd suggest to look at the yaml files in the .ci folder. The mingw would be a hybrid between Windows and Ubuntu-16 yaml files. If you document what commands you run to compile and test, the CI is essentially exactly those commands. |
Sorry, I was just assuming the It's kind of strange the I'll have a look at the yaml files and try to make a PR after I've fixed the compilation issues I'm having. |
I think I might be on to something. The first pcl/common/src/bearing_angle_image.cpp Line 78 in 4316e11
Now, the first include in this file is pcl/common/src/bearing_angle_image.cpp Line 43 in 4316e11
and the first lines of pcl/common/include/pcl/common/eigen.h Lines 43 to 55 in 4316e11
So this is the first time the I'm not sure why compilation works on other platforms/compilers though, since the code would be the same for those. Now if we just swap L55 and L56 of pcl/common/include/pcl/common/eigen.h Lines 55 to 56 in 4316e11
it seems like the error would go away, since |
Could you check if #3545 fixes this issue? |
I'll check that PR asap, but I've made several discoveries lately:
|
#3545 did not fix the issue, compilation fails in the same place as before
|
When compiling pcl on Windows using MSYS2 mimgw-w64 I get a lot of
'M_PI' was not declared in this scope
errors.Full error log
The first error is in
bearing_angle_image.cpp
, but I seeM_PI
is used in many other places as well.Exact steps to reproduce are:
How to fix
What I did was to just add a top-level
add_definitions(-D_USE_MATH_DEFINES)
toCMakeLists.txt
, but I realize this is not the proper way to fix this.I see some trickery is happening on Windows in pcl_macros.h, but I am not certain if there is a similar way to do it for MSYS2.
I think the root issue is that the CMake commandThis is not true. Since we haveset(CMAKE_CXX_STANDARD 14)
causes the-std=gnu++14
flag to be added on Linux, but on Windows+MSYS2 the-std=c++14
flag is added instead. This thatM_PI
is not defined on MSYS2, since that macro is not part of the C++14 standard.set(CMAKE_CXX_EXTENSIONS OFF)
Linux, the flag is the same on Linux and Windows/MSYS2.Your Environment
The text was updated successfully, but these errors were encountered: