如何使用"Code :: Blocks 20.03"("mingw"版本)进行调试? [英] How do you debug using 'Code::Blocks 20.03' (the "mingw" version)?
问题描述
我使用 Code :: Blocks 20.03
构建了一个 Console Application
,该控制台是使用 codeblocks-20.03mingw-setup.exe
安装的.使用了安装目录的默认值(请参见Note01)和安装类型(完整).
我尝试通过使用 Debug
菜单进行 Debug
,单击 Start/Continue
,并且调试失败.
我猜想从发生的事情的日志中得到的重要信息是
启动调试对象失败:未指定可执行文件,请使用"target exec"
下面给出了尝试调试的完整输出.
所以我的问题是,如何使用 Code :: Blocks 20.03("mingw"版本)
进行调试?
下面是尝试运行调试会话的完整输出.
活动调试器配置:GDB/CDB调试器:默认进行构建以确保源是最新的选择目标:除错添加源目录:C:\ CodeBlocks20.03Small \ ConsoleApplication \ program01INc
添加源目录:C:\ CodeBlocks20.03Small \ ConsoleApplication \ program01INc
添加文件:C:\ CodeBlocks20.03Small \ ConsoleApplication \ program01INc \ bin \ Debug \ program01INc.exe将目录更改为:C:/CodeBlocks20.03Small/ConsoleApplication/program01INc/.设置变量:PATH = .; C:\ Program Files \ CodeBlocks \ MinGW \ bin; C:\ Program Files \ CodeBlocks \ MinGW; C:\ Program Files \ Microsoft MPI \ Bin; C:\ Program Files(x86)\ CommonFiles \ 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)管理引擎组件\ DAL; C:\ ProgramFiles \ Intel \ Intel(R)管理引擎组件\ IPT; C:\ Program Files(x86)\ Intel \ Intel(R)Management Engine组件\ DAL; C:\ Program Files(x86)\ Intel \ Intel(R)管理引擎组件\ IPT; C:\ Program Files \ Microsoft \ Web平台安装程序; C:\ Program Files \ Microsoft SQL Server \ 110 \ Tools \ Binn; C:\ Program Files(x86)\ Skype \ Phone; C:\程序文件(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文件(x86)\ clisp-2.49启动调试对象:C:\ MinGW \ bin \ gdb.exe -nx-全名-quiet -args C:/CodeBlocks20.03Small/ConsoleApplication/program01INc/bin/Debug/program01INc.exe完毕设置断点调试器名称和版本:GNU gdb(GDB)7.6.1启动调试对象失败:未指定可执行文件,请使用"target exec".调试器的状态为0
在构建项目时,我使用了 Select Compiler
对话框中的默认设置.
Note01:
似乎(应该在2021年4月11日)始终使用默认目录进行安装.卸载时,我在 C:\ Program Files \ CodeBlocksSmall
中安装了 Code :: Blocks
版本,卸载程序仅接受 C:\ ProgramFiles \ CodeBlocks
作为要从中卸载的目录.我手动删除了 CodeBlocksSmall
目录.当我使用 codeblocks-20.03-setup.exe
安装时,我注意到了这种现象.
相关问题启动调试对象失败:未指定可执行文件,请使用`targetexec'
======================
希望我在解决问题上取得了进展.
尝试调试会话似乎无意中使用了 MinGW
的先前安装(不再可能).查看文件的参与情况
C:\ MinGW \ bin \ gdb.exe
,在行中
启动调试器:C:\ MinGW \ bin \ gdb.exe -nx-全名-quiet -args
现在,当我尝试运行调试会话时,失败发生的方式有所不同(请参见接下来的四行).
在我看来,至少我需要更改指示的行为
启动调试器:C:\ MinGW \ bin \ gdb.exe -nx-全名-quiet -args
由...产生的行为
启动调试器:C:\ Program Files \ CodeBlocks \ MinGW \ bin \ gdb.exe -nx-全名-安静-args
活动调试器配置:GDB/CDB调试器:默认进行构建以确保源是最新的选择目标:除错添加源目录:C:\ Codeblocks20.03 \ ConsoleApp \ program01INcForAnswer
添加源目录:C:\ Codeblocks20.03 \ ConsoleApp \ program01INcForAnswer
添加文件:C:\ Codeblocks20.03 \ ConsoleApp \ program01INcForAnswer \ bin \ Debug \ program01INcForAnswer.exe将目录更改为:C:/Codeblocks20.03/ConsoleApp/program01INcForAnswer/.设置变量:PATH = .; C:\ Program Files \ CodeBlocks \ MinGW \ bin; C:\ Program Files \ CodeBlocks \ MinGW; C:\ Program Files \ Microsoft MPI \ Bin; C:\ Program Files(x86)\ CommonFiles \ 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)管理引擎组件\ DAL; C:\ ProgramFiles \ Intel \ Intel(R)管理引擎组件\ IPT; C:\ Program Files(x86)\ Intel \ Intel(R)Management Engine组件\ DAL; C:\ Program Files(x86)\ Intel \ Intel(R)管理引擎组件\ IPT; C:\ Program Files \ Microsoft \ Web平台安装程序; C:\ Program Files \ Microsoft SQL Server \ 110 \ Tools \ Binn; C:\ Program Files(x86)\ Skype \ Phone; C:\程序文件(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启动调试器:C:\ MinGW \ bin \ gdb.exe -nx-全名-安静-args C:/Codeblocks20.03/ConsoleApp/program01INcForAnswer/bin/Debug/program01INcForAnswer.exe失败
另一个相关的问题在
错误消息就像上面显示的一样,也请参见下面
启动调试器:C:\ MinGW \ bin \ gdb.exe -nx-全名-quiet -args C:/Codeblocks20.03/ConsoleApp/program01INcForAnswer/bin/Debug/program01INcForAnswer.exe失败
请注意,在两种情况下, Code :: Blocks
都试图从目录 C:\ MinGW \ bin
要进行调试,如果安装 Code的
. MinGW
版本,则需要此处描述的修复程序类型::使用 codeblocks-20.03mingw-setup.exe
(2021年4月8日版本,接受默认安装)在 Windows
上阻止20.03
为了使它正常工作,我做了以下工作.
从 Settings
菜单中单击 Debugger ..
,然后在屏幕左侧选择调试器类型 Default
.这显示了可执行路径
设置为
C:\ MinGW \ bin \ gdb.exe
我将其更改为
C:\ Program Files \ Codeblocks \ MinGW \ bin \ gdb.exe
然后我可以使用调试器.
I have built a Console Application
using Code::Blocks 20.03
, which was installed using codeblocks-20.03mingw-setup.exe
. The defaults for the installation directory(see Note01) and the installation type (Full), were used.
I tried to Debug
by using the Debug
menu, clicking Start/Continue
, and debugging failed.
I guess the important information from the log of what happened is
Starting the debuggee failed: No executable specified, use `target exec'
The full output from trying to debug is given below.
So my question is, how do you debug using Code::Blocks 20.03 (the "mingw" version)
?
Full Output from trying to run a debugging session follows.
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
In building my project I used the defaults from the Select Compiler
dialog box.
Note01:
It looks as if you should (date 11th April 2021) always use the default directory, to install. I installed a version of Code::Blocks
in C:\Program Files\CodeBlocksSmall
when I went to uninstall it, the uninstaller would only accept C:\Program Files\CodeBlocks
as the directory to uninstall from. I deleted the CodeBlocksSmall
directory manually. I noticed this behaviour when I installed using codeblocks-20.03-setup.exe
.
Related question Starting the debuggee failed: No executable specified, use `target exec'
=======================
I have hopefully made progress towards an answer.
It looks as if a prior installation of MinGW
was inadvertently being used by the attempted debugging session(this is no longer possible). See the involvement of the file
C:\MinGW\bin\gdb.exe
, in the line
Starting debugger: C:\MinGW\bin\gdb.exe -nx -fullname -quiet -args
Now when I try to run a debugging session, failure occurs differently (see just after the next four lines).
It looks to me, as if I need to at least, change the behaviour indicated by
Starting debugger: C:\MinGW\bin\gdb.exe -nx -fullname -quiet -args
to behaviour produced by
Starting debugger: C:\Program Files\CodeBlocks\MinGW\bin\gdb.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.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
Another related question is at
code blocks failed message runing hello code
There, the error message is like the one shown just above, and see also below
Starting debugger: C:\MinGW\bin\gdb.exe -nx -fullname -quiet -args C:/Codeblocks20.03/ConsoleApp/program01INcForAnswer/bin/Debug/program01INcForAnswer.exe failed
Note that, in both cases, Code::Blocks
is trying to invoke a debugger from the directory C:\MinGW\bin
To get debugging working, the type of fix described here wil be required if you install the MinGW
version of Code::Blocks 20.03
on Windows
, using codeblocks-20.03mingw-setup.exe
( the 8th April 2021 version, with the default installation accepted ).
What I did to get it to work was the following.
From the Settings
menu I clicked on Debugger..
, then on the left of the screen selected Default
, a debugger type. This showed me Executable paths
which was set to
C:\MinGW\bin\gdb.exe
I changed this to
C:\Program Files\Codeblocks\MinGW\bin\gdb.exe
I was then able to use the debugger.
这篇关于如何使用"Code :: Blocks 20.03"("mingw"版本)进行调试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!