Including Boost Python libraries produces C2039 compiler error

Open
#130 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
25/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
compilers

Research direction

Reproduce the include failure with Boost 1.76, MSVC v143, C++17, and Python 3.7, then inspect boost/core/cmath.hpp alongside boost/python.hpp, boost/python/numpy.hpp, and boost/python/detail/wrap_python.py. Confirm the cause of the missing std::_copysign declaration and verify that the affected Boost headers compile under the reported configuration.

Written by the indexing model from the issue text.

Description

I have built Boost_1.76 with the following configurations.

Compiler: MSVC 143
Build Tools: bootstrap.bat, b2 engine
Python Version: 3.7
b2 Command: b2 --build-dir=build/x64 address-model=64 threading=multi --build-type=complete --stagedir=./stage/x64 -j 12
// Conversion.hpp
#include <boost/python.hpp>        // import produces C2039
#include <boost/python/numpy.hpp>  // import produces C2039
#include <boost/tuple/tuple.hpp>
#include <boost/shared_ptr.hpp>
// Conversion.cpp
#include "Conversion.hpp" // importing the header file produces the compiler error

I am compiling the project with the following specs.

Compiler: MSVC cl.exe
C++ Standard: ISO C++17
Platform Toolset: Visual Studio 2022 (v143)

The compilation generates the following error.

C2039: '_copysign' is not a member of 'std' 
File: boost_1_76_python37\boost\core\cmath.hpp

I looked at python.hpp and numpy.hpp and could only find a reference to std::cmath inside boost\python\detail\wrap_python.py, which is used over boost::core::cmath. I checked the std::cmath header and copysign is neither declared nor defined. How do I make sure that my Boost library uses the copysign in boost::core::cmath?

Dominant language
C++
Stars
156
Forks
116
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from boostorg/core

All issues in boostorg/core

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.