Windows/Cygwin - 不能使用 pybind11 - 犯错误
Windows/Cygwin - Can't use pybind11 - make error
我想在一个项目中集成实用工具pybind11。我的工作环境是窗户。
要安装pybind11,有以下页面:Pybind First设置
我在窗户下试了好几次,好几天(3(,使用Eclipse,然后使用Python和Mingw。然后使用Visual Studio
在所有这些之后,我尝试了Linux,在一个小时内我得到了这个例子:
#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");
}
c++-O3-墙共享-std=c++11-fPIC
python3 -m pybind11 --includes
示例.cpp-o示例python3-config --extension-suffix
除了Python之外还有测试。
在这之后,我决定用cygwin使它成功。
我在这里:
easy_install-3.6 pip
python3 -m pip install pytest
python3 -m pip install pybind11
python3 -m pip install python-config
然后在pybind11主下
mkdir build
cd build
cmake ..
make check -j 4
我有两条警告和一条注释:
警告:"pybind11::buffer::buffer(pybind11:::handle,bool
链接时,这里有一个错误,但有很多错误。
/tmp/ccqNl6ln.ltrans0.ltrans.o::(.text+0x12f16(:对"pybind11::index_error::index_eerror(([clone.lto_priv.4841][clone.lto_priv.4883]"的未定义引用
pybind11对于项目来说确实是一个加号。但我不能在Windows上使用它。
有人用cygwin编译过pybind11吗
提前非常感谢
用pip安装3个模块后
python3 -m pip install pytest
python3 -m pip install pybind11
python3 -m pip install python-config
下面的例子,工作
#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");
}
如果编译为:
c++ -O3 -Wall -shared -std=c++11 -fPIC $(python3 -m pybind11 --includes) example.cpp -o example$(python3-config --extension-suffix) -lpython3.6m
相关文章:
- Windows/Cygwin - 不能使用 pybind11 - 犯错误
- Pybind11 错误未定义对"Py_GetVersion"的引用
- 在Raspbian上编译pybind11测试用例时出现致命错误
- 从 pybind11 构建导入模块时出现"分段错误(核心转储)"
- Python 和 C++ (Pybind11):Python 扩展模块导入错误
- pybind11:属性错误:尝试从 py 文件运行函数时,模块'XXX'没有属性'YYY'
- 使用 Pybind11 将函数集成到 Python C++错误,同时使用 PYBIND11_MODULE
- 作者在解释C 中的堆栈和堆时犯了一个错误,或者我正在误读某些内容
- 我哪里犯了错误
- 我很确定我犯了一个愚蠢的错误,但是这段代码给出的输出太长而无法阅读
- 在 pybind11 和 C++ 中添加源时,没有给出目标错误
- 我在哪里可以从C 中的单链接列表中创建此函数到搜索元素时犯了错误
- pybind11基本回调,不兼容的功能签名错误
- 使用 pybind11 在 C++ 中嵌入 Python,分段错误
- Linux Pybind11 'build check -j 4' 错误
- 错误:调用 'pybind11::buffer_info::buffer_info 没有匹配函数
- affdex.cpp:9:31:致命错误:pybind11/pybind11.h:没有这样的文件或目录 #include < pybind11/pybind11.h>
- 此代码给出错误的输出无法找出我在哪里犯了错误
- Pybind11类型错误
- 犯了一个非常愚蠢的 C/C++ 数组/数组指针错误