我使用Code::Blocks 20.03
构建了一个Console Application
,它是使用codeblocks-20.03mingw-setup.exe
安装的。使用了安装目录(参见 Note01)和安装类型(完整)的缺省值。
我尝试使用Debug
菜单,单击Start/Continue
进行Debug
,调试失败。
我想发生的事情日志中的重要信息是
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.03SmallConsoleApplicationprogram01INc
Adding source dir: C:CodeBlocks20.03SmallConsoleApplicationprogram01INc
Adding file: C:CodeBlocks20.03SmallConsoleApplicationprogram01INcbinDebugprogram01INc.exe
Changing directory to: C:/CodeBlocks20.03Small/ConsoleApplication/program01INc/.
Set variable: PATH=.;C:Program FilesCodeBlocksMinGWbin;C:Program FilesCodeBlocksMinGW;C:Program FilesMicrosoft MPIBin;C:Program Files (x86)Common FilesOracleJavajavapath;C:ProgramDataOracleJavajavapath;C:Program Files (x86)InteliCLS Client;C:Program FilesInteliCLS Client;C:WindowsSystem32;C:Windows;C:WindowsSystem32wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:Program FilesIntelIntel(R) Management Engine ComponentsDAL;C:Program FilesIntelIntel(R) Management Engine ComponentsIPT;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsDAL;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsIPT;C:Program FilesMicrosoftWeb Platform Installer;C:Program FilesMicrosoft SQL Server110ToolsBinn;C:Program Files (x86)SkypePhone;C:Program Files (x86)Gitbin;C:Program Files (x86)Gitcmd;C:UsersRoger.dnxbin;C:Program FilesMicrosoft DNXDnvm;C:Program FilesMicrosoft SQL Server130ToolsBinn;C:Program Files (x86)GtkSharp2.12bin;C:Program Files (x86)Microsoft ASP.NETASP.NET Web Pagesv1.0;c:Program Files (x86)Microsoft SQL Server110ToolsBinn;c:Program FilesMicrosoft SQL Server110DTSBinn;C:Program FilesIntelWiFibin;C:Program FilesCommon FilesIntelWirelessCommon;C:WindowsSystem32OpenSSH;C:Program Files (x86)FreeFem++;C:Program Filesdotnet;C:Program FilesMicrosoft SQL ServerClient SDKODBC170ToolsBinn;C:Program Files (x86)Microsoft VS Codebin;C:UsersRogerAppDataLocalProgramsPythonPython38-32Scripts;C:UsersRogerAppDataLocalProgramsPythonPython38-32;C:UsersRogerAppDataLocalProgramsMiKTeX 2.9miktexbinx64;C:texlive2017binwin32;C:UsersRogerAppDataLocalMicrosoftWindowsApps;;C:Program Files (x86)clisp-2.49
Starting debuggee: C:MinGWbingdb.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
对话框中的默认值。
注01:
看起来您应该(日期 2021 年 4 月 11 日)始终使用默认目录进行安装。我在C:Program FilesCodeBlocksSmall
中安装了Code::Blocks
版本,当我去卸载它时,卸载程序只会接受C:Program FilesCodeBlocks
作为要卸载的目录。我手动删除了CodeBlocksSmall
目录。当我使用codeblocks-20.03-setup.exe
安装时,我注意到了这种行为。
相关问题 启动调试对象失败:未指定可执行文件,请使用"目标可执行文件">
====
=================== 看起来好像尝试的调试会话无意中使用了先前安装的MinGW
(这不再可能)。查看文件的参与情况
C:MinGWbingdb.exe
, 在行中
Starting debugger: C:MinGWbingdb.exe -nx -fullname -quiet -args
现在,当我尝试运行调试会话时,失败的发生方式不同(请参阅接下来的四行之后)。
在我看来,我至少需要改变
Starting debugger: C:MinGWbingdb.exe -nx -fullname -quiet -args
产生的行为
Starting debugger: C:Program FilesCodeBlocksMinGWbingdb.exe -nx -fullname -quiet -args
<小时 />Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: C:Codeblocks20.03ConsoleAppprogram01INcForAnswer
Adding source dir: C:Codeblocks20.03ConsoleAppprogram01INcForAnswer
Adding file: C:Codeblocks20.03ConsoleAppprogram01INcForAnswerbinDebugprogram01INcForAnswer.exe
Changing directory to: C:/Codeblocks20.03/ConsoleApp/program01INcForAnswer/.
Set variable: PATH=.;C:Program FilesCodeBlocksMinGWbin;C:Program FilesCodeBlocksMinGW;C:Program FilesMicrosoft MPIBin;C:Program Files (x86)Common FilesOracleJavajavapath;C:ProgramDataOracleJavajavapath;C:Program Files (x86)InteliCLS Client;C:Program FilesInteliCLS Client;C:WindowsSystem32;C:Windows;C:WindowsSystem32wbem;C:WindowsSystem32WindowsPowerShellv1.0;C:Program FilesIntelIntel(R) Management Engine ComponentsDAL;C:Program FilesIntelIntel(R) Management Engine ComponentsIPT;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsDAL;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsIPT;C:Program FilesMicrosoftWeb Platform Installer;C:Program FilesMicrosoft SQL Server110ToolsBinn;C:Program Files (x86)SkypePhone;C:Program Files (x86)Gitbin;C:Program Files (x86)Gitcmd;C:UsersRoger.dnxbin;C:Program FilesMicrosoft DNXDnvm;C:Program FilesMicrosoft SQL Server130ToolsBinn;C:Program Files (x86)GtkSharp2.12bin;C:Program Files (x86)Microsoft ASP.NETASP.NET Web Pagesv1.0;c:Program Files (x86)Microsoft SQL Server110ToolsBinn;c:Program FilesMicrosoft SQL Server110DTSBinn;C:Program FilesIntelWiFibin;C:Program FilesCommon FilesIntelWirelessCommon;C:WindowsSystem32OpenSSH;C:Program Files (x86)FreeFem++;C:Program Filesdotnet;C:Program FilesMicrosoft SQL ServerClient SDKODBC170ToolsBinn;C:Program Files (x86)Microsoft VS Codebin;C:UsersRogerAppDataLocalProgramsPythonPython38-32Scripts;C:UsersRogerAppDataLocalProgramsPythonPython38-32;C:UsersRogerAppDataLocalProgramsMiKTeX 2.9miktexbinx64;C:texlive2017binwin32;C:UsersRogerAppDataLocalMicrosoftWindowsApps;C:Program Files (x86)clisp-2.49
Starting debugger: C:MinGWbingdb.exe -nx -fullname -quiet -args C:/Codeblocks20.03/ConsoleApp/program01INcForAnswer/bin/Debug/program01INcForAnswer.exe
failed
另一个相关问题在
代码块失败的消息运行 hello 代码
在那里,错误消息就像上面显示的一样,另请参阅下文
Starting debugger: C:MinGWbingdb.exe -nx -fullname -quiet -args C:/Codeblocks20.03/ConsoleApp/program01INcForAnswer/bin/Debug/program01INcForAnswer.exe failed
请注意,在这两种情况下,Code::Blocks
都尝试从目录调用调试器C:MinGWbin
要使调试正常工作,如果您在codeblocks-20.03mingw-setup.exe
Windows
上安装MinGW
版本的Code::Blocks 20.03
,则需要使用此处描述的修复类型(2021 年 4 月 8 日版本,接受默认安装)。
我为让它工作所做的
工作如下。从Settings
菜单中,我单击了Debugger..
,然后在屏幕左侧选择了Default
,调试器类型。这Executable paths
向我展示了
设置为C:MinGWbingdb.exe
我把它改成了
C:Program FilesCodeblocksMinGWbingdb.exe
然后我能够使用调试器。