2

I've been having a problem with compiling.

I used the following test C code below and saved it as test.c in Home folder.

#include <stdio.h>
int main()
{
  printf("Bruh!");
  return 0;
}

When I run in terminal the code

 gcc test.c -o test

I get nothing. Thank you

1
  • Did you run ./test?
    – muru
    Mar 22, 2015 at 13:09

1 Answer 1

4

You are compiling the code, not running it, the correct procedure is:

  • Create the source file (test.c)
  • Compile it with gcc test.c -o test
  • Run it with ./test

Also you can make a oneliner with these commands:

gcc test.c -o test; ./test

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.