I want to build a program from the source file on C. To do this, perform in the console

bash$ gcc hello.c -o hello 

result

 'bash$' is not recognized as an internal or external command,... 

What am I doing wrong?

Closed due to the fact that it is off-topic by the participants Streletz , Nicolas Chabanovsky ♦ 30 Sep '16 at 5:11 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - Streletz, Nicolas Chabanovsky
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • "File on C" can not run in principle. You can write a program in C, compile it and run the resulting binary ( .exe if it is windows) for execution. - zed

2 answers 2

Surely you took it from some tutorial. Usually bash$ added just as an example of a command line prompt. The very same command is gcc hello.c -o hello , and that’s what you need to write.

  • No, the same (. Maybe you need to prescribe something before that? - Max
  • @Max What OS and is the C compiler installed? - Alex Chermenin
  • Windows Well, I downloaded the Dev-C ++ prog and everything compiles in it, but it doesn't work in the console. Tutorial took from wiki - Max
  • 2
    Included with Dev-C ++ is installed MinGW, you need to find the folder in which it is installed and add the \bin inside it to the PATH variable. - Alex Chermenin
  • one

gcc hello.c -o hello compile a file for you. And to run it, you need to make it executable chmod +x hello and then run ./hello

  • chmod is superfluous here. - PinkTux
  • I understand, but judging by the question, comrade is completely new and better to peredet :) - Smithson
  • Judging by the comments, a friend has Windows at all. - zed