Code::Blocks 无法编译应用程序

标签 c codeblocks

这是我的 hello world 代码:

#include <stdio.h>
#include <stdlib.h>

int main()
{
    printf("Hello world!\n");
    return 0;
}

当我尝试运行应用程序时出现错误:

Target uses an invalid compiler; run aborted

所以我去了 Settings->Compiler->Toolchain Executables,然后我选择了 C:\MinGW\bin,我也试过 C:\MinGW 并且我仍然得到同样的错误。

我已经从官方 Code::Blocks 站点使用 mingw 安装了 Code::Blocks。

请帮忙,我想开始学习 C 但我不能...

最佳答案

您在项目的构建选项中选择了错误的编译器或者您没有在编译器设置中设置可执行文件。

在项目中选择编译器:

首先,转到 Project 菜单并选择 Build options:

Project menu

然后,在 Build options 对话框中,选择您在问题中描述的已设置的编译器:

Build Options dialog

更改编译器的可执行文件:

转到 Settings,然后是 Compiler:

Settings->Compiler

然后选择工具链可执行文件:

Toolchain Executables

并填写您的可执行文件名称:

enter image description here

关于Code::Blocks 无法编译应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30558261/

相关文章:

无法使用 C 中的 write() 函数写入 .txt 文件

c - 如果我们使用 if(a>b>c) # a 大于所有三个结果为 false

c++ - 错误 : 'Friend Member Function Name' was not declared in this scope

c++ - 如何使用代码块编译 64 位 SDL 代码(没有管理员权限)

c++ - gcc 或 makefile 是否有一种机制可以描述源文件的包含文件以替换 #include "xxxx.h"?

c++ - 未定义的函数引用 "CashRegister::GetTotalPrice"

c - 如何将用户输入作为sql语句的参数

c - 在 C 中执行文件操作时,数字被 append 而不是被添加到 int 变量中

c - 编译 C 程序时体系结构 x86_64 的 undefined symbol

c++ - 程序不断出现段错误