Thread: warning: error

  1. #1
    Registered User
    Join Date
    Dec 2001
    Posts
    227

    warning: error

    i keep getthing an error in my code and i dont know what does this error means

    warning: no newline at end of file

    here is my code

    #include<stdio.h>

    void draw_box(int, int);

    int main(void)

    {

    draw_box(8, 35 );
    return 0;

    }

    void draw_box(int row, int collum)

    {
    int col;

    for(; row > 0; row--)
    {
    for(col = collum; col>0; col--)
    printf("X");

    printf("\n");
    }
    }

  2. #2
    Registered User
    Join Date
    Aug 2001
    Posts
    247
    beats me, compiled and ran your program okay.

    since it is a warning only, run your program and then compile again.
    hoping to be certified (programming in c)
    here's the news - I'm officially certified.

  3. #3
    Registered User
    Join Date
    Dec 2001
    Posts
    227
    hhmm you are right.. but why did i get that error mess... do you know... and how can i make it print my name in xxxx lke for example how can i make it print hello thanx..

  4. #4
    The Artful Lurker Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    If you are interested in knowing what the warning meant, post the warning message along with the name and version of your compiler.
    Jason Deckard

  5. #5
    Registered User
    Join Date
    Dec 2001
    Posts
    227
    my warning messege is:::

    warning: no newline at end of file
    compiler::: gcc (linux)

    btw do you know were i can find a tut.. on how to creat a program to print my name in starts(*) this way i can understand the code and what they are.. thanx

  6. #6
    The Artful Lurker Deckard's Avatar
    Join Date
    Jan 2002
    Posts
    633
    Originally posted by xlordt
    warning: no newline at end of file
    compiler::: gcc (linux)
    Ah, this is easy to fix. Open up your favorite text editor/IDE and go to the last line of your code. Go to the end of that line and press enter. Save and recompile.
    Jason Deckard

  7. #7
    Registered User
    Join Date
    Dec 2001
    Posts
    227
    ohh damn hehe thanx

  8. #8
    Unregistered
    Guest
    If you're curious about the warning, the C standard requires that all source files end in a newline. Generally, it's no big deal and most compilers will just spit out the warning and continue translation, but it's possible in theory that a compiler could reject the program just on this basis.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  2. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 01:29 PM
  3. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  4. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM
  5. Linking error
    By DockyD in forum C++ Programming
    Replies: 10
    Last Post: 01-20-2003, 05:27 AM