compile

cd /
cc usr/home/user1/c! / tom.c

this compile won't work. tom.c compiles in the directory in which it resides. error says something about a.out can't be opened or something.
any ideas why the compile won't work??
 
cd /
cc usr/home/user1/c! / tom.c
You’re in the root directory, the top of the file system hier(7)archy. I guess cc(1) wants to write /a.out, yet by default only the superuser root can write to/change anything in this directory. Specify an ‑output file to overrule this behavior.​
Bash:
cc -o ~/my_executable ~/my_program.c
i wish I knew a way to get the error text into a file so I could attach it.
Diagnostic messages are usually written to standard error, the file that has the index 2, cmp. stdio(3). By default standard error is displayed on the terminal, but you can redirect any writes to that file, cmp. § Redirections in sh(1):​
Bash:
cc … 2> /tmp/error.txt
 
I attached a file that shows what freebsd had to say about this. I believe I tried to do this as root and it wouldn't work. wouldn't a.out be wirtten to the the file where the source code is? i am using version 12.

Code:
$ cd /                                                                          

$ cc usr/home/user1/c!/tom.c                                                    

/usr/bin/ld: cannot open output file a.out: Permission denied                   

cc: error: linker command failed with exit code 1 (use -v to see invocation)
 
Back
Top