GCC 编译器不工作

GCC 编译器不工作

原始错误:

root@vishal-HP-Notebook:/home/vishal# sudo apt-get install gcc Reading package lists... Done Building dependency tree
Reading state information... Done gcc is already the newest version (4:7.3.0-3ubuntu2). 0 upgraded, 0 newly installed, 0 to remove and 179 not upgraded. root@vishal-HP-Notebook:/home/vishal# gcc gcc: fatal error: no input files compilation terminated.

root@vishal-HP-Notebook:/home/vishal# sudo apt-get install gcc
Reading package lists... Done
Building dependency tree       
Reading state information... Done
gcc is already the newest version (4:7.3.0-3ubuntu2).
0 upgraded, 0 newly installed, 0 to remove and 179 not upgraded.
root@vishal-HP-Notebook:/home/vishal# gcc
gcc: fatal error: no input files
compilation terminated.

按照 Niclas Börlin 的回答:

vishal@vishal-HP-Notebook:~$ cat v.c
#include<stdio.h>
void main()
{
printf("Mudit");
}
vishal@vishal-HP-Notebook:~$ gcc v.c
vishal@vishal-HP-Notebook:~$ a.out
a.out: command not found
vishal@vishal-HP-Notebook:~$ gcc --version
gcc (Ubuntu 4.8.5-4ubuntu8) 4.8.5
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

vishal@vishal-HP-Notebook:~$ 

我如何使用它作为代码块 IDE 我有一个在终端上运行的方法

vishal@vishal-HP-Notebook:~$ cat v.c
#include<stdio.h>
void main()
{
printf("Mudit");
}
vishal@vishal-HP-Notebook:~$ gcc v.c
vishal@vishal-HP-Notebook:~$ ./a.out
Muditvishal@vishal-HP-Notebook:~$

答案1

gcc当我调用时没有任何文件名,我得到相同的输出,所以它看起来像 gcc在职的。

尝试gcc file.c使用包含一些 c 代码的文件。如果代码正确,它应该会生成一个名为的可执行文件a.out

答案2

确实安装了

尝试下面的命令并查看当前版本

> gcc --version

接下来去寻找 GCC 教程或者阅读手册

相关内容