Skip to content

Compilation problem with boost/math/constants/constants.hpp #209

Closed

Description

@eliseemond

gcc version : 4.9.2
boost version: 1.61 and 1.64

Error message:
/usr/include/boost/math/constants/constants.hpp:300:3: note: use -std=gnu++11 or -fext-numeric-literals to enable more built-in suffixes
/usr/include/boost/math/constants/constants.hpp: In static member function 'static constexpr T boost::math::constants::detail::constant_root_two_pi<T>::get(const mpl_::int_<5>&)':
/usr/include/boost/math/constants/constants.hpp:301:3: error: unable to find numeric literal operator 'operator""Q'
   BOOST_DEFINE_MATH_CONSTANT(root_two_pi, 2.506628274631000502415765284811045253e+00, "2.50662827463100050241576528481104525300698674060993831662992357634229365460784197494659583837805726611600997267e+00")
   ^

It can be solved by adding -DBOOST_MATH_DISABLE_FLOAT128 to the C++ flags.

Activity

  1. junhyeokahn commented on Feb 14, 2019

    @junhyeokahn

    @eliseemond Could you tell me how can I add this flag in CMakeLists.txt?

  2. eliseemond commented on Feb 15, 2019

    @eliseemond
    ContributorAuthor

    @junhyeokahn Hi, you can add this in CMakeLists.txt:
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_MATH_DISABLE_FLOAT128")

    You could check the Boost version:

    if (${Boost_VERSION} LESS 106500)
    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_MATH_DISABLE_FLOAT128")
    endif()

  3. KrisThielemans commented on Feb 15, 2019

    @KrisThielemans
    Collaborator

    @eliseemond feel like creating a PR?

  4. eliseemond commented on Feb 15, 2019

    @eliseemond
    ContributorAuthor

    @KrisThielemans The problem was solved and merged via PR in 5710d43, but we could move the fix to CMakeLists. Otherwise, close the github issue.

  5. KrisThielemans commented on Sep 13, 2026

    @KrisThielemans
    Collaborator

    Seems obsolete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions