0

This is my first time using Ubuntu to run a C-File with a codeBlocks

  1. I tried save as a File "file1" without extension file.

    Permission Denied

  2. I tried chmod u+x file1

    Wrong something but builded success

  3. I tried give "file1.c"

    File not found

BeGood
  • 539

2 Answers2

0

First of all, Any C program is saved with .c Extension. And C++ program is saved with .cpp extension.

Now coming to compilation,

  1. If you want to compile it using Terminal, Open the terminal (Press CTRL + ALT + T).

  2. Go to the directory where the file is saved. (You can use cd command to change directory).

  3. After reaching the directory , type gcc file1.c.

  4. If there are no errors, then you can run the output by typing ./a.out.

-1

Make sure you're the owner of the files. If you're not, you can run:

sudo chown usrname:username /path/to/your/file

Also make sure it's executable:

chmod +x /path/to/your/file
Bilal
  • 3,699