我使用Code::Blocks 20.03构建了一个Code::Blocks 20.03,它是使用codeblocks-20.03mingw-setup.exe安装的。使用了安装目录(请参见Note01)和安装类型(完整)的默认值。
我尝试使用Debug菜单,单击Start/Continue,然后调试失败。
我想记录上发生的事情的重要信息是
Starting the debuggee failed: No executable specified, use `target exec'试图调试的全部输出如下所示。
我的问题是,如何使用Code::Blocks 20.03 (the "mingw" version)进行调试?
以下是尝试运行调试会话的全部输出。
Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\CodeBlocks20.03Small\ConsoleApplication\program01INc\
Adding source dir: C:\CodeBlocks20.03Small\ConsoleApplication\program01INc\
Adding file: C:\CodeBlocks20.03Small\ConsoleApplication\program01INc\bin\Debug\program01INc.exe
Changing directory to: C:/CodeBlocks20.03Small/ConsoleApplication/program01INc/.
Set variable: PATH=.;C:\Program Files\CodeBlocks\MinGW\bin;C:\Program Files\CodeBlocks\MinGW;C:\Program Files\Microsoft MPI\Bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;C:\Program Files (x86)\Skype\Phone;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd;C:\Users\Roger\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn;c:\Program Files\Microsoft SQL Server\110\DTS\Binn;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\FreeFem++;C:\Program Files\dotnet;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\Roger\AppData\Local\Programs\Python\Python38-32\Scripts;C:\Users\Roger\AppData\Local\Programs\Python\Python38-32;C:\Users\Roger\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64;C:\texlive\2017\bin\win32;C:\Users\Roger\AppData\Local\Microsoft\WindowsApps;\;C:\Program Files (x86)\clisp-2.49
Starting debuggee: C:\MinGW\bin\gdb.exe -nx -fullname -quiet -args C:/CodeBlocks20.03Small/ConsoleApplication/program01INc/bin/Debug/program01INc.exe
done
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 7.6.1
Starting the debuggee failed: No executable specified, use `target exec'.
Debugger finished with status 0
===============================在构建我的项目时,我使用了Select Compiler对话框中的默认值。
Note01:
看起来,您应该始终使用默认目录来安装(日期为2021年4月11日)。我在C:\Program Files\CodeBlocksSmall中安装了一个版本的C:\Program Files\CodeBlocksSmall,当我卸载它时,卸载程序只接受C:\Program Files\CodeBlocks作为要卸载的目录。我手动删除了CodeBlocksSmall目录。当我使用codeblocks-20.03-setup.exe安装时,我注意到了这种行为。
相关问题Starting the debuggee failed: No executable specified, use `target exec'
=======================
看起来,尝试调试会话无意中使用了先前安装的MinGW (这不再可能)。请参阅文件的参与情况
C:\MinGW\bin\gdb.exe,在线上
Starting debugger: C:\MinGW\bin\gdb.exe -nx -fullname -quiet -args现在,当我尝试运行调试会话时,失败发生的方式有所不同(请参阅后面四行)。
在我看来,至少我需要改变
Starting debugger: C:\MinGW\bin\gdb.exe -nx -fullname -quiet -args所产生的行为
Starting debugger: C:\Program Files\CodeBlocks\MinGW\bin\gdb.exe -nx -fullname -quiet -argsActive debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:\Codeblocks20.03\ConsoleApp\program01INcForAnswer\
Adding source dir: C:\Codeblocks20.03\ConsoleApp\program01INcForAnswer\
Adding file: C:\Codeblocks20.03\ConsoleApp\program01INcForAnswer\bin\Debug\program01INcForAnswer.exe
Changing directory to: C:/Codeblocks20.03/ConsoleApp/program01INcForAnswer/.
Set variable: PATH=.;C:\Program Files\CodeBlocks\MinGW\bin;C:\Program Files\CodeBlocks\MinGW;C:\Program Files\Microsoft MPI\Bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Microsoft\Web Platform Installer;C:\Program Files\Microsoft SQL Server\110\Tools\Binn;C:\Program Files (x86)\Skype\Phone;C:\Program Files (x86)\Git\bin;C:\Program Files (x86)\Git\cmd;C:\Users\Roger\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn;c:\Program Files\Microsoft SQL Server\110\DTS\Binn;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\FreeFem++;C:\Program Files\dotnet;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\170\Tools\Binn;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\Roger\AppData\Local\Programs\Python\Python38-32\Scripts;C:\Users\Roger\AppData\Local\Programs\Python\Python38-32;C:\Users\Roger\AppData\Local\Programs\MiKTeX 2.9\miktex\bin\x64;C:\texlive\2017\bin\win32;C:\Users\Roger\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\clisp-2.49
Starting debugger: C:\MinGW\bin\gdb.exe -nx -fullname -quiet -args C:/Codeblocks20.03/ConsoleApp/program01INcForAnswer/bin/Debug/program01INcForAnswer.exe
failed另一个相关的问题是
code blocks failed message runing hello code
在那里,错误消息就像上面显示的一样,也见下面。
Starting debugger: C:\MinGW\bin\gdb.exe -nx -fullname -quiet -args C:/Codeblocks20.03/ConsoleApp/program01INcForAnswer/bin/Debug/program01INcForAnswer.exe failed注意,在这两种情况下,Code::Blocks都试图从目录C:\MinGW\bin调用调试器。
发布于 2021-04-11 21:17:26
要使调试工作正常,如果您使用MinGW (2021年4月8日版本,默认安装)在Windows上安装Code::Blocks 20.03版本,那么这里描述的修复类型将是必需的。
为了让它开始工作,我做了以下工作。
在Settings菜单中,我单击了Debugger..,然后在屏幕左侧选择了调试器类型Default。这向我展示了设置为Executable paths的
C:\MinGW\bin\gdb.exe
我把这个换成了
C:\Program Files\Codeblocks\MinGW\bin\gdb.exe
那时我能够使用调试器。
https://stackoverflow.com/questions/67045842
复制相似问题