grame-cncm / libmusicxml

A C/C++ library to support the MusicXML format.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

MinGW g++-6.3.0 fails to compile the current master (80a876f5...)

school510587 opened this issue · comments

I have installed the latest MinGW compiler (i686-6.3.0-posix-dwarf-rt_v5-rev1) and cmake, and I used the following commands to build libmusicxml at the current master branch under libmusicxml/cmake directory:

cmake . -G "MinGW Makefiles"
mingw32-make

I got the following error:

D:...\libmusicxml\src\operations\transposition.cpp: In function 'int round(float)':
D:...\libmusicxml\src\operations\transposition.cpp:26:25: error: 'int round(float)' conflicts with a previous declaration
inline int round(float v) {
^
In file included from C:/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/math.h:36:0,
from D:...\libmusicxml\src\operations\transposition.cpp:18:
C:/mingw-w64/i686-6.3.0-posix-dwarf-rt_v5-rev1/mingw32/lib/gcc/i686-w64-mingw32/6.3.0/include/c++/cmath:1790:3: note: previous declaration 'constexpr float std::round(float)'
round(float __x)
^~~~~

This inline function should not be present when round() is already implemented.
(However, 5.x series didn't generate this error.)
I think testing compiler macros such as GNUC may work, or cmake command check_function_exists must help.
check_function_exists looks like check_function_exists(round HAVE_ROUND).

Successfully build libmusicxml.dll with g++-6.3.0 using build/CMakeLists.txt in origin/dev branch.