c++ - 在 C++ 文件 CDT 中包含 Python.h

标签 c++ python eclipse-cdt embedding

如果这是一个愚蠢的问题,我深表歉意。但是我试着用谷歌搜索这个,但我找不到任何东西来指引我正确的方向。我只是想了解我需要做什么来“设置”cdt 以“理解”我的 python.h 包含。

错误的说法是这样的:

#include <Python.h>

但我也试过了

#include "Python.h"

CDT 会在旁边用一个错误标志做出回应:

Multiple markers at this line
- fatal error: Python.h: No such file or 
 directory
- Unresolved inclusion: <Python.h>

我在 Ubuntu 12.04 上使用 Eclipse CDT Juno。任何指针都会很棒!

最佳答案

请参阅此路径以了解如何设置环境以使用 cpython。

  1. fully detailed tutorial for Linux
  2. github项目包含在 MAC OSx 上使用的所有相关文件。
  3. 使用 python-config 获取 Python.h 和 python 静态库的路径,您应该将代码与之链接。

关于c++ - 在 C++ 文件 CDT 中包含 Python.h,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15670586/

相关文章:

c++ - 为什么我的字符串在此代码中被修改?

python - 模块 VTK 无法在 Windows 上读取 Python3 中的文件

python - 在 Tensorflow 急切模式下计算梯度与模型输入

python - 在 Python 中处理传递性

c - Eclipse 中的 GDB 调试器找不到 FILE

c++ - 如果在共享内存中,pthread 互斥锁是否可以跨线程工作?

c++ - 代码生成 - usleep 与 std::this_thread::sleep_for

c++ - valgrind callgrind是使用total time还是 "execution time"来创建数据

c++ - 在另一个库(SDL 和 Eclipse)之上构建一个新库

eclipse - 如何在 C++ Eclipse 项目中定义自定义构建命令而不是 "make all"?