简体   繁体   English

从'unsigned __int64'到'unsigned __int64 *'的转换错误-Pybind11

[英]Conversion Error from 'unsigned __int64' to 'unsigned __int64 *' - Pybind11

After downloading this https://github.com/pybind/pybind11/archive/v2.2.3.zip and creating a simple cpp file: 下载此https://github.com/pybind/pybind11/archive/v2.2.3.zip并创建简单的cpp文件后:

#include <pybind11/pybind11.h>

int add(int i, int j) { return i + j; }

PYBIND11_MODULE(example, m) {
    m.doc() = "pybind11 example plugin"; // optional module docstring
    m.def("add", &add, "A function which adds two numbers");
}

with

在此处输入图片说明

I get this error 我得到这个错误

在此处输入图片说明

Error C2446 '<': no conversion from 'unsigned __int64' to 'unsigned __int64 *' in c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\include\vector line 2326

Would anybody know what this could be referring to, and possibly how to fix it? 有人知道这可能是什么意思,以及可能的解决方法吗?


As requested, here the full error log: 根据要求,这里是完整的错误日志:

1>------ Rebuild All started: Project: Test_CreatePythonBindings, Configuration: Debug x64 ------
1>example.cpp
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\include\vector(2326): error C2446: '<': no conversion from 'unsigned __int64' to 'unsigned __int64 *'
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\include\vector(2326): note: Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\include\vector(2325): note: while compiling class template member function 'std::_Vb_const_iterator<std::_Wrap_alloc<std::allocator<std::_Vbase>>> &std::_Vb_const_iterator<std::_Wrap_alloc<std::allocator<std::_Vbase>>>::operator +=(__int64)'
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\include\vector(2545): note: see reference to function template instantiation 'std::_Vb_const_iterator<std::_Wrap_alloc<std::allocator<std::_Vbase>>> &std::_Vb_const_iterator<std::_Wrap_alloc<std::allocator<std::_Vbase>>>::operator +=(__int64)' being compiled
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\include\vector(2490): note: see reference to class template instantiation 'std::_Vb_const_iterator<std::_Wrap_alloc<std::allocator<std::_Vbase>>>' being compiled
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\include\vector(3094): note: see reference to class template instantiation 'std::_Vb_iterator<std::_Wrap_alloc<std::allocator<std::_Vbase>>>' being compiled
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\include\vector(3093): note: while compiling class template member function 'void std::vector<bool,std::allocator<_Ty>>::push_back(const bool &)'
1>        with
1>        [
1>            _Ty=bool
1>        ]
1>c:\pybind11-2.2.3\include\pybind11\pybind11.h(513): note: see reference to function template instantiation 'void std::vector<bool,std::allocator<_Ty>>::push_back(const bool &)' being compiled
1>        with
1>        [
1>            _Ty=bool
1>        ]
1>c:\pybind11-2.2.3\include\pybind11\cast.h(1806): note: see reference to class template instantiation 'std::vector<bool,std::allocator<_Ty>>' being compiled
1>        with
1>        [
1>            _Ty=bool
1>        ]
1>c:\program files (x86)\microsoft visual studio\2017\professional\vc\tools\msvc\14.14.26428\include\vector(2326): warning C4554: '&': check operator precedence for possible error; use parentheses to clarify precedence
1>Done building project "Test_CreatePythonBindings.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

It appears to be a VS 2017 issue related to 这似乎是与VS 2017有关的问题

  std::vector<bool>

Separate question asked here: Pushback on vector<bool> fails - VS 2017 在此处提出单独的问题: vector <bool>上的推回失败-VS 2017

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM