I am having problems with GCC, when I go to compile a program, even one as simple as hello world, it tells me the file or directory was not found. I have tried many different ways of trying to get it to compile in xterm. I have used commands “gcc -o hello helloworld.c”, “gcc -o hello /home/<user>/programs helloworld.c” where <user> is the user name, and other variations.
On 2013-03-28 02:16, darkakater wrote:
>
> I am having problems with GCC, when I go to compile a program, even one
> as simple as hello world, it tells me the file or directory was not
> found. I have tried many different ways of trying to get it to compile
> in xterm. I have used commands “gcc -o hello helloworld.c”, “gcc -o
> hello /home/<user>/programs helloworld.c” where <user> is the user name,
> and other variations.
Please show complete sample like this, using code tags:
cer@Telcontar:~> gcc hello.c
gcc: error: hello.c: No such file or directory
gcc: fatal error: no input files
compilation terminated.
cer@Telcontar:~>
Please use code tags for printouts and commands. Advanced editor, ‘#’
button. Posting in Code Tags - A Guide
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)
Code:
logan@linux-6e3q:~> gcc /home/logan/programs -o helloworld HellowWorld.c
gcc: error: HelloWorld.c: No such file or directory
logan@linux-6e3q:~> gcc -o helloworld HelloWorld.c
gcc: error: HelloWorld.c: No such file or directory
gcc: fatal error: no input files
compilation terminated
logan@linux-6e3q:~> gcc -o helloworld /home/logan/programs HelloWorld.c
gcc: error: HelloWorld.c: No such file or directory
Sorry messed up a bit
logan@linux-6e3q:~> gcc /home/logan/programs -o helloworld HellowWorld.c
gcc: error: HelloWorld.c: No such file or directory
logan@linux-6e3q:~> gcc -o helloworld HelloWorld.c
gcc: error: HelloWorld.c: No such file or directory
gcc: fatal error: no input files
compilation terminated
logan@linux-6e3q:~> gcc -o helloworld /home/logan/programs HelloWorld.c
gcc: error: HelloWorld.c: No such file or directory
On 2013-03-28 03:46, darkakater wrote:
>
> Code:
> logan@linux-6e3q:> gcc /home/logan/programs -o helloworld HellowWorld.c
> gcc: error: HelloWorld.c: No such file or directory
Where are the code tags I asked for?
Anyway, as far as it seems, “HelloWorld.c” does not exist, so prove it
does with an “ls -l HelloWorld.c”.
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)
This is what I got
logan@linux-6e3q:~> ls -| HelloWorld.c
If 'HelloWorld.c' is not a typo you can use command-not-found to lookup the package that contains it, like this:
cnf HelloWorld.c
ls: cannot access-: No such file or directory
logan@linux-6e3q:~>
On 2013-03-28 04:06, darkakater wrote:
>
> Sorry messed up a bit
>
> Code:
> --------------------
> logan@linux-6e3q:~> gcc /home/logan/programs -o helloworld HellowWorld.c
> gcc: error: HelloWorld.c: No such file or directory
> logan@linux-6e3q:~> gcc -o helloworld HelloWorld.c
> gcc: error: HelloWorld.c: No such file or directory
> gcc: fatal error: no input files
> compilation terminated
> logan@linux-6e3q:~> gcc -o helloworld /home/logan/programs HelloWorld.c
> gcc: error: HelloWorld.c: No such file or directory
> --------------------
Ok! We are getting ahead. What we need to check now is what it says,
that the file exists or not. Ie:
ls -l HelloWorld.c
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)
typed in wrong haha this is what I now got
logan@linux-6e3q:~> ls -I HelloWorld.c
bin Desktop Documents Downloads Music Pictures programs Public public-html Templates Videos
logan@linux-6e3q:~>
Or this depending on the letter
logan@linux-6e3q:~> ls -l HelloWorld.c
ls: cannot access HelloWorld.c: No such file or directory
logan@linux-6e3q:~>
On 2013-03-28 04:26, darkakater wrote:
>
> robin_listas;2541943 Wrote:
>> On 2013-03-28 03:46, darkakater wrote:
>> Anyway, as far as it seems, “HelloWorld.c” does not exist, so prove it
>> does with an “ls -l HelloWorld.c”.
>>
> This is what I got
>
> Code:
> --------------------
>
> logan@linux-6e3q:~> ls -| HelloWorld.c
> If ‘HelloWorld.c’ is not a typo you can use command-not-found to lookup the package that contains it, like this:
> cnf HelloWorld.c
> ls: cannot access-: No such file or directory
> logan@linux-6e3q:~>
>
> --------------------
Sigh.
That was a lower case “L” after the dash, not a bar. Why did you not
copypaste the line? Or look up the help for the “ls” command?
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)
Hi
So where did you save the HelloWorld.c file…?
find . -name HelloWorld.c
I saved it to /home/logan/programs
logan@linux-6e3q:~> find . -name HelloWorld.c
./programs/HelloWorld.c
logan@linux-6e3q:~>
Hi
So either cd to the directory or use the fullpath (with no spaces)
gcc -o helloworld progams/HelloWorld.c
or
cd programs
gcc -o helloworld HelloWorld.c
On 2013-03-28 04:46, darkakater wrote:
>
> typed in wrong haha this is what I now got
Yes, you did
> Code:
> --------------------
>
> logan@linux-6e3q:~> ls -l HelloWorld.c
> ls: cannot access HelloWorld.c: No such file or directory
> logan@linux-6e3q:~>
>
> --------------------
This one. So, “HelloWorld.c” does not exist, exactly what gcc was
telling you. Computers do not lie… you can not compile a file that
does not exist.
Surely, you edited a file, but where did you save it? Or what exact name
did you give it? If you change a single letter, if you change an “1” to
an “l” or “|” or “L” it does not work.
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)
I tried both and got this.
logan@linux-6e3q:~> gcc -o helloworld programs/HelloWorld.c
programs/HelloWorld.c:1:20: fatal error: stdio.h: No such file or directory
compilation terminated
logan@linux-6e3q:~> cd programs
logan@linux-6e3q:~/programs> gcc -o helloworld HelloWorld.c
HelloWorld.c:1:20: fatal error: stdio.h: No such file or directory
compilation terminated
logan@linux-6e3q:~/programs>
I saved it to /home/logan/programs and did not change a single letter. proof is when I used
find . -name HelloWorld.c
and it came back telling me
./programs/HelloWorld.c
On 2013-03-28 04:56, darkakater wrote:
>
> I saved it to /home/logan/programs
>
> Code:
> --------------------
>
> logan@linux-6e3q:~> find . -name HelloWorld.c
> ./programs/HelloWorld.c
> logan@linux-6e3q:~>
>
> --------------------
Good! You found it.
Now, do we really need to tell you what to do?
You either change to that directory before running gcc, or give gcc the
correct path to the file.
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)
Hi
You don’t have the glibc-devel package installed which contains the header file.
How might I get the package? Sorry I’m kind of new to linux.
On 2013-03-28 05:16, darkakater wrote:
> I saved it to /home/logan/programs and did not change a single letter.
> proof is when I used
I was covering possibilities. You did confuse letters when I asked for
the listing
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)
On 2013-03-28 05:16, darkakater wrote:
>
> I tried both and got this.
>
> Code:
> --------------------
>
> logan@linux-6e3q:~> gcc -o helloworld programs/HelloWorld.c
> programs/HelloWorld.c:1:20: fatal error: stdio.h: No such file or directory
> compilation terminated
> logan@linux-6e3q:~> cd programs
> logan@linux-6e3q:~/programs> gcc -o helloworld HelloWorld.c
> HelloWorld.c:1:20: fatal error: stdio.h: No such file or directory
> compilation terminated
> logan@linux-6e3q:~/programs>
>
> --------------------
And /that/ is an error inside your hello world program. Now you could
post the file here (in code tags, please), or try to figure out the
mistake. I’m guessing that you are trying to learn C, so it would be
really better if you tried on your own, and come back if you can’t,
because we all learn from fighting mistakes. And yes, it is a fight
My guess is that you made an error in the include line, but I could also
be wrong.
–
Cheers / Saludos,
Carlos E. R.
(from 12.1 x86_64 “Asparagus” at Telcontar)