VS Code配置的c++环境中运行包含vector的程序时,遇到了类似这样的错误:
ERROR: Unable to start debugging. Unexpected GDB output from command “-exec-run”. During startup program exited with code 0xc0000139.
测试代码为:
#include#include using namespace std; int main() { vector prices = {1,2,3,7,9}; int a = 1; a+=9; a--; cout<
运行cpp文件报错为:
原因分析:
运行可执行文件出现错误为:
无法定位程序输入点__gxx_personality_sj0于动态链接库
这实际上是库的问题,未找到C++的标准模板库
解决方法和原理参考:
https://stackoverflow.com/questions/69038667/vs-code-gdb-debug-error-unable-to-start-debugging-unexpected-gdb-output-fromhttps://stackoverflow.com/questions/18668003/the-procedure-entry-point-gxx-personality-v0-could-not-be-located
解决方案:原理是将库文件直接放在需要执行文件目录下
解决步骤:
①.进入你的mingw64/bin目录下,我的是D:ProgramFilesmingw64bin
②.将libstdc++ -6.dll拷贝到需要执行文件目录下
③.重新运行或调试就可以啦



