本文主要是介绍使用vscode debug cpp/python混合编程的程序(从python调用的C++编译的dll),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
使用vscode debug cpp/python混合编程的程序(从python调用的C++编译的dll)
1. 安装插件 Python C++ Debugger
https://marketplace.visualstudio.com/items?itemName=benjamin-simmonds.pythoncpp-debug
2. 在.vscode/launch.json中增加配置
拷贝自 https://marketplace.visualstudio.com/items?itemName=benjamin-simmonds.pythoncpp-debug
{"name": "Python C++ Debug","type": "pythoncpp","request": "launch","pythonLaunchName": "Python: Current File","cppAttachName": "(Windows) Attach",},{"name": "(Windows) Attach","type": "cppvsdbg","request": "attach","processId": ""},{"name": "Python: Current File","type": "python","request": "launch","program": "${file}","console": "integratedTerminal"}
3. 开始调试
大致原理
采用了attach process的方式,大致是根据dll的process id将debugger挂载上去。
具体可查看
https://marketplace.visualstudio.com/items?itemName=benjamin-simmonds.pythoncpp-debug
这篇关于使用vscode debug cpp/python混合编程的程序(从python调用的C++编译的dll)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!