Search code examples
cbashgccgcc-warningkali-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.

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. 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 ".

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:

" /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. 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.


Solution

  • Oh no! You removed the gcc binary (or symlink...) from your PC and replaced it with the header file.

    I would recommend to reinstall gcc first:

    sudo apt-get install gcc --reinstall
    

    Now just run gcc to see what it does:

    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?