-5

I have downloaded clang. When I got onto terminal and type clang it results in the error no input files.

Eliah Kagan
  • 117,780
  • You need to pass an input file to it. e.g. clang your_file.c – Carl H Jul 03 '17 at 07:12
  • 1
    You need to know that clang is only a compiler, which make an executable file. Maybe you are looking for an Integrated Development Environment (IDE), which you are used too from Windows. Look for IDE for linux. – nobody Jul 03 '17 at 07:34
  • 1
    as people said clang is only a compiler -> it runs only in console. No GUI .. I would recommend e.g. Code::Blocks as a good tool where you can choose between gcc, clang and others – derHugo Jul 03 '17 at 11:04
  • 1
    Do you have a source code file that you are trying to compile? (As clang says, you have not given it any input files.) What are you trying to do? – Eliah Kagan Jul 04 '17 at 06:18

1 Answers1

2

The clang: error: no input files error in your question means exactly what it says. You need to specify an input file after typing clang in the terminal in order to tell clang what code to run.

This example uses the clang package from the default Ubuntu repositories (clang-3.8) and the following source code for hello.c.

#include <stdio.h>
int main(int argc, char **argv) { 
    printf("hello world\n"); 
}

Change directories using cd to the directory containing hello.c (the input file) and compile it using the following command:

clang hello.c

The compiled executable file will be named a.out. Run it using the following command:

./a.out

The results of ./a.out are:

hello world
karel
  • 114,770