Skip to content
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

build python binding error on windows 10,msvc14,python3.6. #212

Open
kingctan opened this issue Jun 13, 2018 · 11 comments
Open

build python binding error on windows 10,msvc14,python3.6. #212

kingctan opened this issue Jun 13, 2018 · 11 comments

Comments

@kingctan
Copy link

D:\local\boost_1_67_0\boost/python/operators.hpp(223): error C2065: "op_": undeclared identifier
D:\local\boost_1_67_0\boost/python/operators.hpp(223): error C2059: Syntax error: ">"
D:\local\boost_1_67_0\boost/python/operators.hpp(223): error C2976: "boost::python::detail::operator_l": Template parameters are too few
D:\local\boost_1_67_0\boost/python/operators.hpp(40): note: See the declaration of "boost::python::detail::operator_l"
D:\local\boost_1_67_0\boost/python/operators.hpp(223): error C2913: Explicit specialization; "boost::python::detail::operator_l" is not a specialization of a class template
D:\local\boost_1_67_0\boost/python/operators.hpp(223): error C2065: "op_": undeclared identifier
D:\local\boost_1_67_0\boost/python/operators.hpp(223): error C2059: Syntax error: ">"
D:\local\boost_1_67_0\boost/python/operators.hpp(223): error C2976: "boost::python::detail::operator_r": Template parameters are too few
D:\local\boost_1_67_0\boost/python/operators.hpp(45): note: See the declaration of "boost::python::detail::operator_r"
D:\local\boost_1_67_0\boost/python/operators.hpp(223): error C2913: Explicit specialization; "boost::python::detail::operator_r" is not specialization of class template
D:\local\boost_1_67_0\boost/python/operators.hpp(224): error C2913: Explicit customization; "boost::python::detail::operator_l" is not a specialization of the class template
D:\local\boost_1_67_0\boost/python/operators.hpp(224): error C2913: Explicit customization; "boost::python::detail::operator_r" is not a specialization of the class template
@Nanoatic
Copy link

i have the same issue did you find a way to solve it ?

@fun4jimmy
Copy link

I have also encountered this issue. It seems to be caused by a header defining rand before boost/python/operators.hpp is included. I found reordering my header files fixed it.

@hyyz17200
Copy link

@fun4jimmy I have this problem too. Plz how to fixed it? Reorder which file?

@stefanseefeld
Copy link
Member

@fun4jimmy , "defining" as in macro ? Yuck ! It seems Windows as a habit of doing that...
Can you submit a patch (PR) for this ?

@hyyz17200
Copy link

Solved. modified cpp files in '\libtorrent-rasterbar-1.1.9\bindings\python\src'. Like @fun4jimmy said, change the order, move '#include "boost_python.hpp"' to the top.
I still have other 3 faild info, but not these ones. I will figure out after.

@hyyz17200
Copy link

@stefanseefeld is this problem related to boost ,or libtorrent ?

@stefanseefeld
Copy link
Member

I have no idea. It sounds like MSVC defines a rogue macro that conflicts with symbols used in Boost.Python. If that's the case, there is nothing I can do but suggest exactly the action you have already taken: reorder the headers so this pollution doesn't affect Boost.Python code. So it's Boost.Python users (such as libtorrent) that need to adjust.

@ssiloti
Copy link

ssiloti commented Nov 1, 2018

The problematic defines are for the alternative operator tokens like and, xor, eq, etc. These defines are coming from ciso646 which is included at least by Boost.Asio as a way of getting information on supported C++ versions.

The msvc documentation suggests it might be possible to use the /Za option to disable these defines, but it breaks many Windows SDK headers.

@stefanseefeld
Copy link
Member

I suggest you lay out your code in a way that you can #undef the rogue macros prior to including Boost.Python header files, to avoid the above errors.

@lightzls
Copy link

If you are using Boost.Asio with Boost.Python, just open the file boost/asio/detail/config.hpp, remove line 73-75. It has been fixed in boost-1.69.0.
Ref commit: boostorg/asio@569cba5#diff-90ac9e94f73cea8d74f04eebdd5551d7

@Nanoatic
Copy link

Nanoatic commented Dec 30, 2018

Just tried it today with visual studio 2017 and python 3.7/boost-1.69 , I can confirm it is working fine. Cheers 😄
capture

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants