Results 1 to 10 of 11
I wrote a small c program just fooling around
# include <stdio.h>
main()
{
printf("Hello");
}
when I compile
cc Hello.c
I get the following.
Hello.c:1:20: error: stdio.h: No such ...
- 04-11-2008 #1Just Joined!
- Join Date
- Jul 2007
- Posts
- 61
stdio.h
I wrote a small c program just fooling around
# include <stdio.h>
main()
{
printf("Hello");
}
when I compile
cc Hello.c
I get the following.
Hello.c:1:20: error: stdio.h: No such file or directory
Hello.c: In function ‘main’:
Hello.c:4: warning: incompatible implicit declaration of built-in function ‘printf’
- 04-11-2008 #2
Header file is missing-i guess.
remove that #include directive and compile.
If this not works then -try and download latest gcc complier and compile again.- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 04-11-2008 #3Just Joined!
- Join Date
- Jul 2007
- Posts
- 61
I thought the stdio header file came with C compilers.
- 04-11-2008 #4Just Joined!
- Join Date
- Mar 2008
- Posts
- 23
u should make sure g++ is installed or updated.
i came across such error one day, then i installed g++ and it was solved. u might have gcc installed but g++ not installed. check out if they are both installed .
then program and library included are totally right
Cheers
- 04-11-2008 #5
In general they do, but sometimes weird things happen.
Try and see if there is a libc or glibc package for you to install.DISTRO=Arch
Registered Linux User #388732
- 04-11-2008 #6
Try eliminating the space between the # and include
It may be choking on that.
Your code compiles fine for me, with or without the space, but
then it also compiles without the include line. WTF?
- 04-11-2008 #7Just Joined!
- Join Date
- Jul 2007
- Posts
- 61
Yea I caught that. I took the space out from between # and include and it still did not work. Why would I need to install what I assume is the C++ compiler. I have tried using gcc and just plain cc. Neither works and give the same output. Who do I tell if I need to install the libc or glibc? Where would I find it?
- 04-11-2008 #8
So first off, I'm not sure about "cc". It may be an alias to gcc, or it may be another compiler altogether. In Linux, we usually use gcc (okay, some people use Intel's compiler), so it's a good idea to ensure that you're using gcc.
You do not need a C++ compiler such as g++ if you're not compiling C++ (obviously).
As far as knowing what you need to install: run the command "ls /usr/include/stdio.h". If you get a file listing, then you have stdio.h exists and something is wonky in your configuration. If you get a "no files found" message, then you need to install glibc, which is the actual GNU C Library.
How to install it depends on your distro. If you're using Ubuntu, then use Synaptic to find "build-essential", and if that's already installed, check packages called "libc" or "glibc".
What distro are you using?DISTRO=Arch
Registered Linux User #388732
- 04-11-2008 #9Just Joined!
- Join Date
- Jul 2007
- Posts
- 61
There's a libc6 istalled. I don't see a plain libc.
And there's a glibc-doc that's not installed
Oh I found build essentials and I'm installing it now.
And that worked it made a a.out file since I did not specify a output file name thanks!
Now if I could get javac to work from the command line. Netbeans compiles programs fine and it uses the JDK6 that I installed. I even tried to run it from where javac was located and it still did not work.
- 04-11-2008 #10
I'm glad that it all worked!
What happens when you try to run javac?DISTRO=Arch
Registered Linux User #388732


Reply With Quote