",python,c++,boost,boost-python"/>

首页 > 解决方案 > Boost Python "cannot open source file 'pyconfig.h'" when importing using "#include "

问题描述

I am attempting to use Boost Python for a project. I have downloaded and build version 1.70 on Windows 10, and I am using Visual Studio Code. When attempting to import boost into my c++ project with the line:

#include <boost\python.hpp>

, I receive the following error:

cannot open source file "pyconfig.h" (dependency of "boost\python.hpp")

I have looked into similar issues, and the primary solution I have found was to edit user-config.jam to include the location of my python installation. I have done so, and the line within user-config.jam looks like this:

using python : 3.7 : C:\Users\broke\AppData\Local\Programs\Python\Python37 ;

After adding this line, I rebuilt Boost Python. This did nothing to remedy the issue. I would greatly appreciate help on this matter. Thank you.

标签: pythonc++boostboost-python

解决方案


您需要确保将python/include文件夹添加到您的包含中。C:\Python\Python37\include对我来说在窗户上。您还需要链接 python 库。


推荐阅读