GCC error in compiling
I recently had to reformat my computer and when I reinstalled Cygwin and tried compiling through gcc I get an error that there is no input files and no such file or directory.
I created a folder called home and then the user name in that and put the source files there, but I still get the same error.
Is the error that the compiler can't be found? That is, if you just type "gcc" on the command line, does it work or not? [It will say somethign like "nothing to compile" if it works. ]
if i type just gcc, it says gcc: no input files
So what do you type when it fails, and what is the EXACT error message (use copy from the command window and paste it into your post here).
I'd assume you're not giving gcc any files to work with (ie no arguments), paste exactly what the terminal says (and what you type) here -- as matsp said.
If i type just "gcc" it says:
gcc: no input files
If i type gcc -Wall -o hw3 hw3.c it says:
$gcc -Wall -o hw3 hw3.c
gcc: hw3.c: No such file or directory
gcc: no input files
And there definitely is a hw3.c file in your current directory?
Show your 'ls' result as well.
Or otherwise show that there really is a file with that name.
If you type
does that also produce an error message?
That's kind of the problem, I don't know what or where my current directory is, before I had reformatted my computer, when I had installed cygwin, there was a folder automatically created called "home" and inside that folder there was another folder called "Owner"
And now when I reinstalled it, no such folder was created. So i manually created it, and put the files in there, infact I pasted the hw3.c file in quite a few places.
If i type ls hw3.c
ls: cannot access hw3.c: No such file or directory
The files that you specify to gcc 'hw3.c' is relative to the current working directory.
For example, if you had, /home/jfonseka/mysource which contained 'hw3.c'
You'd do something like,
Since now the folder which contains hw3.c is the current working directory.
> cd /home/jfonseka/mysource
> gcc -Wall -o hw3 hw3.c
Won'd do anything because you haven't told it to, it expects input files (you've speicifed none) -- I suggest doing a man gcc.
 Ahh poo, really late[/edit]
If you have no idea where hw3.c is, search for it
> find / -name hw3.c
Ah ha, now it worked, i didn't know i had to change directory like that, thanks!
Originally Posted by zacs7