简体   繁体   English

GCC 未在 Linux 中编译

[英]GCC Not Compiling in Linux

I was making a c program that includes conio.h library but because I'm on a Debain Based OS, conio.h library is not there pre-installed so I have to search to internet and download it.我正在制作一个包含 conio.h 库的 c 程序,但因为我使用的是基于 Debain 的操作系统,所以没有预装 conio.h 库,所以我必须搜索互联网并下载它。

After downloading it, I wanted to know the path of GCC to copy the file there because I thought that there was a folder named gcc where all headers file are stored.下载后,我想知道 GCC 的路径将文件复制到那里,因为我认为有一个名为 gcc 的文件夹,其中存储了所有头文件。 I searched in the internet to find its path and I saw a blog and they said to run " which gcc " to find it and after I ran it, I got " /usr/bash/gcc ".我在互联网上搜索以找到它的路径,我看到了一个博客,他们说运行“which gcc”来找到它,运行它之后,我得到了“/usr/bash/gcc”。

Now I made " cp conio.h /usr/bash/gcc " but I always get this error if I want to compile any C file or even to get its version:现在我制作了“ cp conio.h /usr/bash/gcc ”,但如果我想编译任何 C 文件甚至获取其版本,我总是会收到此错误:

" /usr/bin/gcc: line 1: syntax error near unexpected token (' /usr/bin/gcc: line 1: // Copyright (C) 2005 by Piotr He�ka (piotr.helka@nd.e-wro.pl)' " " /usr/bin/gcc: line 1: syntax error near unexpected token (' /usr/bin/gcc: line 1: // Copyright (C) 2005 by Piotr He�ka (piotr.helka@nd.e-wro .pl)'"

Every Help Would Be Very Appreciated!每一个帮助都会非常感激!

EDIT: I have solved this issue by copying another functioning gcc to the actual one.编辑:我已经通过将另一个功能gcc复制到实际的来解决了这个问题。 Even reinstalling won't work.即使重新安装也行不通。 Another way you can solve this, is by downloading a binary of gcc and then copy that binary to the place your old broken gcc is.解决此问题的另一种方法是下载binary of gcc ,然后将该二进制文件复制到旧损坏的 gcc 所在的位置。

Oh no.不好了。 You removed the gcc binary (or symlink...) from your PC and replaced it with the header file.您从 PC 中删除了 gcc 二进制文件(或符号链接...),并将其替换为 header 文件。

I would recommend to reinstall gcc first:我建议先重新安装 gcc:

sudo apt-get install gcc --reinstall

Now just run gcc to see what it does:现在只需运行 gcc 看看它做了什么:

gcc

It should say something like "no input files".它应该说“无输入文件”之类的内容。

Now about your conio problem, I suggest you read this stackoverflow question: Why can't I find <conio.h> on Linux?现在关于您的 conio 问题,我建议您阅读这个 stackoverflow 问题: Why can't I find <conio.h> on Linux?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM