Find the answer to your Linux question:
Results 1 to 4 of 4
hello , i am trying to compile my first c program and i am getting the errors...... i am using fedora7......program is just to print hello as follow /* hello.c ...
  1. #1
    Just Joined!
    Join Date
    Feb 2008
    Posts
    29

    [SOLVED] problem compiling c program

    hello ,

    i am trying to compile my first c program and i am getting the errors...... i am using fedora7......program is just to print hello as follow

    /* hello.c */
    #include <stdio.h>
    int main(int argc,char *argv[])
    {
    printf(“hello\n”);
    return(0);
    }

    ......the error i am getting is

    [root@popey include]# gcc hello.c
    hello.c: In function ‘main’:
    hello.c:5: error: stray ‘\342’ in program
    hello.c:5: error: stray ‘\200’ in program
    hello.c:5: error: stray ‘\234’ in program
    hello.c:5: error: stray ‘\’ in program
    hello.c:5: error: ‘hello’ undeclared (first use in this function)
    hello.c:5: error: (Each undeclared identifier is reported only once
    hello.c:5: error: for each function it appears in.)
    hello.c:5: error: expected ‘)’ before ‘n’
    hello.c:5: error: stray ‘\342’ in program
    hello.c:5: error: stray ‘\200’ in program
    hello.c:5: error: stray ‘\235’ in program

    plz tell what is the problem......

  2. #2
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    Post the code of hello.c here.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

  3. #3
    Just Joined!
    Join Date
    Feb 2008
    Posts
    29

    solved

    quotes with hello were wrong

  4. #4
    Super Moderator devils casper's Avatar
    Join Date
    Jun 2006
    Location
    Chandigarh, India
    Posts
    24,316
    I was thinking the same. /342 points to single quote and I think you were using two single quotes as Double quote.
    Glad to know that you have sorted out problem yourself.
    It is amazing what you can accomplish if you do not care who gets the credit.
    New Users: Read This First

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...