c - 为什么我不能在代码块中构建和运行它?

标签 c

enter image description here 这是我的代码

#include <stdio.h>
int main()
{
    int a;
    int b = 9;
    printf("input a integer: ");
    scanf("%d",&a);
    printf("%d + %d = %d\n",a,b,a+b);
    return(0);
}

构建消息:

||=== Build file: "no target" in "no project" (compiler: unknown) ===|
ld.exe||cannot open output file G:\document\C++ and C\Add and Input.exe Permission denied|
||error: ld returned 1 exit status|
||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

我认为我的代码是正确的。但我无法让它顺利运行。

最佳答案

按照以下步骤使用 CodeBlocks 配置您的项目(在我的例子中,项目名称是“容器”)。

1 - 右键单击​​您的项目图标:

enter image description here

2 - 选择“用于调试或/和发布的构建选项:”

enter image description here

3-选择“编译器设置”,然后选中与您的选项相对应的框:

enter image description here

关于c - 为什么我不能在代码块中构建和运行它?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59470725/

相关文章:

c - opencv中播放视频的程序出错

c - 从句子(字符串)中删除一个词

c - 如何在 C 中将所有结构体元素复制到 char * 数组中

c - C语言中如何删除字符串中的特殊字符

c - 最大 CreateProcessWithLogonW 和 NetUserAdd

c - 排序贪婪高分(文件 I/O)

c - main() 的参数是为了什么?

c - disable_local_irq 和内核定时器

c - 在 if? 中保存并使用 memchr 的返回值? "if ( ptr = memchr(str1, ' 4', sizeof(str1)) )"?

c - 将现有 C Code::Blocks 项目实现为 DLL