This is my first time using Ubuntu to run a C-File with a codeBlocks
I tried save as a File "file1" without extension file.
Permission Denied
I tried chmod u+x file1
Wrong something but builded success
I tried give "file1.c"
File not found
This is my first time using Ubuntu to run a C-File with a codeBlocks
I tried save as a File "file1" without extension file.
Permission Denied
I tried chmod u+x file1
Wrong something but builded success
I tried give "file1.c"
File not found
First of all, Any C program is saved with .c Extension. And C++ program is saved with .cpp extension.
Now coming to compilation,
If you want to compile it using Terminal, Open the terminal (Press CTRL + ALT + T).
Go to the directory where the file is saved. (You can use cd command to change directory).
After reaching the directory , type gcc file1.c
.
If there are no errors, then you can run the output by typing ./a.out
.
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
chmod +x
will also fail). A compiler might not make the program executable for the user if umask is set unusually, but then a different chmod
command would be needed as well.
– Eliah Kagan
Jul 30 '17 at 17:48
file1.cpp
? Is it even building correctly? – muru May 24 '15 at 17:07g++ file1.cpp
and c file is saved with.c
extention not.cpp
. – Snake Eyes May 24 '15 at 17:10