c++代码为:
#include<iostream>
using namespace std;
int main()
{
cout<<"hello world"<<endl;
}
执行:
g++ -g hello.cpp -o hello
dir
2022/06/23 10:38 <DIR> .
2022/06/22 16:45 <DIR> ..
2022/06/23 10:06 90 hello.cpp
2022/06/23 10:38 76,554 hello.exe
2022/06/20 16:50 90 hello.txt
3 个文件 76,734 字节
2 个目录 581,220,421,632 可用字节
hello.exe
hello world
但是使用gdb的调试:gdb
(gdb) run
Starting program:
No executable specified, use `target exec'.
(gdb) file
No executable file now.
No symbol file now.
按照网上对该错误的说法
1.路径有中文
2.g++生成exe文件时未加-g
3.gdb版本错误
这些问题我好像都没有犯:
路径:D:\Data_Cppworks\test\hello.exe
where gdb
D:\Users\minGW\mingw64posix\mingw64\bin\gdb.exe
而且mingw使用的版本也没错,是mingw-w64,所以gdb的版本:This GDB was configured as "x86_64-w64-mingw32".
所以到底是哪一步出了问题呢?
gdb hello.exe