启动调试对象失败:未指定可执行文件,请使用"target exec" [英] Starting the debuggee failed: No executable specified, use `target exec'

查看:99
本文介绍了启动调试对象失败:未指定可执行文件,请使用"target exec"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

代码:

#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
// to generate numbers
void gen_data(int b[], int n)
{
    int i;
    for (i = 0; i < n; i++)
        b[i] = rand() % 101;
}
// to display numbers
void disp_data(int b[], int n)
{
    int i;
    for (i = 0; i < n; i++)
        printf("%d \n", b[i]);
}
// insert at desired posn
void insert(int b[], int n, int elt, int pos)
{
    int i;
    for (i = n - 1; i >= pos; i--)
        b[i + 1] = b[i];
    b[pos] = elt;
}
// delete an elt at given position
void delete (int b[], int n, int pos)
{
    int i;
    for (i = pos + 1; i < n; i++)
        b[i - 1] = b[i];
}
// driver code
int main()
{
    int a[100], pos, n = 10, let;
    int opt;
    system("cls");
    gen_data(a, n);
    while (1)
    {
        printf("\n 1- Insert 2-Delete 3-Display 4-quit\n");
        scanf("%d %d", &pos, &elt);
        insert(a, n, elt, pos);
        n++;
        break;
        case 2:
            printf("enter position at which elt to be deleted: ");
            scanf("%d", &pos);
            delete (a, n, pos);
            n--;
            break;
        case 3:
            printf("the numbers are : \n");
            disp_data(a, n);
            break;
    }
    if (opt == 4)
        break;
} // end while
}

日志:

Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target: 
Debug
Adding source dir: C:\Users\Ranju\Desktop\you\lab pro\
Adding source dir: C:\Users\Ranju\Desktop\you\lab pro\
Adding file: C:\Users\Ranju\Desktop\you\lab pro\bin\Debug\lab pro.exe
Changing directory to: "C:/Users/Ranju/Desktop/you/lab pro/."
Set variable: PATH=.;C:\MinGW\bin;C:\MinGW;C:\Windows\System32;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C;C:\Users\Ranju\AppData\Local\Microsoft\WindowsApps;C:\Program Files\CodeBlocks\MinGW\bin
Starting debugger: C:\Program Files\CodeBlocks\MINGW\bin\gdb.exe -nx -fullname -quiet  -args "C:/Users/Ranju/Desktop/you/lab pro/bin/Debug/lab pro.exe"
done
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 8.1
Starting the debuggee failed: No executable specified, use `target exec'.
Debugger finished with status 0

推荐答案

我不知道这可能有多重要,但是我似乎有相同或相似的问题.请参阅以下材料

I don't know how relevant this may be, but I seem to have the same or similar problem. See the material at

如何使用代码"进行调试:: Blocks 20.03'("mingw"版本)?

尤其是在句子之后,我希望在答案方面取得了进展..

我现在为上述问题添加了正确的答案.

I have now added a proper answer to the above question..

我假设您在目录 C:\ MinGW 中安装了 MinGW .

I asume that you have MinGW installed, in the directory C:\MinGW.

也许,有自己的风险,您可以尝试将文件夹 C:\ MinGW 临时重命名为其他名称,然后尝试运行调试器.

Perhaps, AT YOUR OWN RISK, you could try temporarily renaming the folder C:\MinGW to something else, and try running the debugger.

当我使用 codeblocks-20.03mingw-setup.exe 安装了 Code :: Blocks 20.03 时,我已经预安装了 MinGW (2021年4月8日版本,接受默认安装).我在调试时也遇到了问题.现在有一个针对此问题的修复程序,似乎很笼统,即使没有预先安装的 MinGW ,也可以应用,请参见其他问题的答案(上面的链接).

I had MinGW pre-installed, when I installed Code::Blocks 20.03 using codeblocks-20.03mingw-setup.exe ( the 8th April 2021 version , default installation accepted). I also had a problem debugging. There is now a fix for this, which seems quite general, applying even without a pre-installed MinGW, see the answer to the other question ( link provided above ).

此修复程序涉及更改调试器设置,但是在您的情况下,您似乎正在尝试使用正确的调试器,请参见所给出的行,该行如下所示

The fix involves changing a debugger setting, but in your case, you seem to be trying to use the correct debugger, see the line that you give, which is shown just below

启动调试器:C:\ Program Files \ CodeBlocks \ MINGW \ bin \ gdb.exe -nx-全名-安静-args"C:/Users/Ranju/Desktop/you/lab pro/bin/Debug/lab pro.exe"

在上面,您似乎正在尝试从目录 C:\ Program Files \ Codeblocks \ MinGW \ bin 使用调试器,这似乎不错,而不是中的一个调试器.我尝试使用的> C:\ MinGW \ bin ,这是调试器所在的位置,请参见另一个问题.

In the above, you appear to be trying to use a debugger, from the directory, C:\Program Files\Codeblocks\MinGW\bin, which seems O.K., rather than one from C:\MinGW\bin, which is where the debugger was, that I was trying to use, see the other question.

但是,您可能正在使用目录 C:\ MinGW 中的调试器以外的其他东西.

However, you may be using something other than the debugger from the directory C:\MinGW.

是否在 C:\ MinGW 中安装了 MinGW ,您可能需要更改 Code中的某些 Setting ::块.

Whether or not you have MinGW installed in C:\MinGW, you may need to alter some Setting in Code::Blocks.

这篇关于启动调试对象失败:未指定可执行文件,请使用"target exec"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆