Help with my first C Compile

This is a discussion on Help with my first C Compile within the C Programming forums, part of the General Programming Boards category; I have the below code, trying to compile it on the latest Ubuntu (Debian) OS, 2.6.10 Kernel. and getting the ...

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    1

    Help with my first C Compile

    I have the below code, trying to compile it on the latest Ubuntu (Debian) OS, 2.6.10 Kernel. and getting the following errors:
    Code:
    #include
    
    main()
    {
            printf( "Hello, world!\n" );
    }
    Error:

    andrewj@ubuntu-vaio:~$ cc hello.c
    hello.c:1:9: #include expects "FILENAME" or <FILENAME>

    Tried it as root, tried everything I could on the net but can't sort it. Talk about falling at the first hurdle!!???!!!

    If anyone has any ideas to I can get coding in C, it would be much appreciated.

    Many thanks,
    Andrew Jones

  2. #2
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,006
    Code:
    #include <stdio.h>
    
    int main()
    {
       printf( "Hello, world!\n" );
       return 0;
    }
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  3. #3
    Registered User cbastard's Avatar
    Join Date
    Jul 2005
    Location
    India
    Posts
    167
    Quote Originally Posted by andrewjonesUK
    Tried it as root, tried everything I could on the net but can't sort it. Talk about falling at the first hurdle!!???!!!

    If anyone has any ideas to I can get coding in C, it would be much appreciated.

    Many thanks,
    Andrew Jones
    it happens with everyone who tries to learn a new language.
    you hv to give the name of header file to include which u hv'nt given.corrected by sinkula.
    u hv to include the respective header file if u r using any standard lib function.header file contains the info(prototype)

  4. #4
    ... kermit's Avatar
    Join Date
    Jan 2003
    Posts
    1,528
    Quote Originally Posted by cbastard
    it happens with everyone who tries to learn a new language.
    you hv to give the name of header file to include which u hv'nt given.corrected by sinkula.
    u hv to include the respective header file if u r using any standard lib function.header file contains the info(prototype)
    yes - like this one:
    Code:
    #include <stdsplling.h>

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C and C++ compile speed
    By swgh in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 01-02-2007, 02:37 PM
  2. Compile as you type
    By Rocketmagnet in forum A Brief History of Cprogramming.com
    Replies: 33
    Last Post: 12-07-2006, 01:36 PM
  3. How to compile mfc libs from platform sdk
    By tjcbs in forum Windows Programming
    Replies: 6
    Last Post: 11-19-2006, 08:20 AM
  4. Compile crashes certain windows
    By Loduwijk in forum C++ Programming
    Replies: 5
    Last Post: 03-26-2006, 09:05 PM
  5. How can I compile C or C++ with Visual Studio .NET?
    By Dakkon in forum C Programming
    Replies: 8
    Last Post: 02-11-2003, 02:58 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21