What warnings are you getting?
Anyway, you need to add a return value unless you change to function from
int main() to void main(). void main() is considered to be "bad"
programming though. Add "return 0;" as your last line in the main()
function. That will return the integer value of 0 (zero) to the system and
is required if you use int main(). The "int" in int main() means that you
are returning an integer value to the operating system. You should have a
statement of #include <stdio.h> at the beginning of the program, also.
Usually, a compiler will complain unless you include a header file with the
function prototype and the compiler normally complains if you declare a
function with a return value but don't provide a return value statement
within the body of the function (the data types have to match also).
At 05:52 PM 12/31/2001 -0500, eric wrote:
>Dear Pen:
> I tried your 4 lines program, it still not print out even I use gcc -v
>or cc -v to compile, actually after the gcc -v I got a lot of junks
>waring.
>
> Same thing, at bash it is not be printed, but it can be shown at csh.
>rpm -q gcc
>2.96-0.48mdk (probably straight from 8.0 standard edition)
>rpm -q bash
>bash-2.04-18mdk(straight from 8.0 standard edition)
>
> you may check your bash in your 8.1 , is that same edition as mine in
>8.0? may be that is the problem.
>
>eric, [EMAIL PROTECTED]
>
>Pen Gwynne wrote:
>>
>> Eric,
>>
>> Please do "gcc -v" or "cc -v" and tell us what it says. I have the
following
>> 4 line program:
>>
>> int main()
>> {
>> printf("Hello World!");
>> }
>>
>> It compiles and run properly, even without the normal "#include" files.
I am
>> using a straight Mandrake 8.1 installation and my version of gcc is 2.96
>> 20000731.
>>
>> Now let me say this. My prompt is the normal, or default
>>
>> [pen@myhost dir]$
>>
>> When I run the program what I see is:
>>
>> Hello World![pen@myhost dir]$
>>
>> You should also be aware of one more "funny" thing that Linux does. After
>> running a.out, the hello world example, As soon as I type something,
>> anything, then the hello world program output and my prompt line:
>>
>> Hello World![pen@myhost dir]$
>>
>> is comes just:
>>
>> [pen@myhost dir]$
>>
>> It looks like the program never printed anything at all.
>>
>> Hope this helps.
>> /Pen
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com