Thread: Please help with my first program!

  1. #1
    Registered User
    Join Date
    Jun 2013
    Posts
    5

    Angry Please help with my first program!

    Hi! I'm in a C Programming class and just today downloaded notepad++ and the borland 5.5 compiler. It took me so long to get it to accept the include statements and after a lot of googling I finally figured it out. Now my simple test program won't work! It says statement missing ; in function main. Here is the program, very simple:

    Code:
    #include <stdio.h>
    int main( )
    {
        printf( "hello\n" );
        return 0;
    }
    I asked on another message board and everyone agreed it looks fine? Can my compiler not read the ";"?? Is it because I have windows 8? I don't know what's wrong! Please help me!

  2. #2
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    The code seems to be ok. You can compile it online if you wish.

    You are not ok with your installation.
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

  3. #3
    Registered User
    Join Date
    Jun 2013
    Posts
    5
    Is there anything you can recommend me to do to fix the problem?

  4. #4
    Registered User
    Join Date
    Jun 2013
    Posts
    5
    Also, I clicked your link and tried to put my code in there and click "run" and got "An error occured. Please contact [email protected]". Is it my computer?? I don't understand!

  5. #5
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Location
    Nice, France
    Posts
    2,694
    I do not have a clue about the installation problem. I copy pasted the code you posted and hit run and got the "hello" output. Trust me the code can run. The problem is in the installation.
    Code - functions and small libraries I use


    It’s 2014 and I still use printf() for debugging.


    "Programs must be written for people to read, and only incidentally for machines to execute. " —Harold Abelson

  6. #6
    Registered User
    Join Date
    Jun 2013
    Posts
    5
    I installed it exactly the same on my boyfriend's computer (windows 7) and it worked fine. Could it be windows 8?? Does anyone else have issues coding with windows 8??

  7. #7
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    Did you copy and past actual code into your post, or did you type in what you think the code does? If so, the code you are compiling may not be the code you have posted here. There are quite a few possibilities (leaving out a single character, inserting another) that might explain your problem.

    Another possibility is that you did something when editing your file that caused notepad++ to insert some other character into your source file. (some characters are invisible on screen, depending on editor settings. If one of those is looking like a space in the printf() statement ..... ).

    Another possibility, as others have said, is a compiler installation problem (that wouldn't explain why online compiling is failing, but would explain the problem with header files). Try uninstalling and reinstalling (if that is a word) your compiler. With an older compiler like Borland 5.5, you almost certainly need to install it using an account with administrative privileges. Windows 8 settings might be affecting installation in other ways, but I doubt it.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  8. #8
    Registered User
    Join Date
    Jun 2013
    Posts
    5
    Thank you guys so much! Since you said it was installation I did also go ahead and re-install everything on my computer in a different folder and tried again and it worked. I don't know what happened but it works now! Thanks!

  9. #9
    Registered User
    Join Date
    Jun 2013
    Posts
    5
    heyy heres what u can do.. instead of writing in notepad++ u cn download an IDE.. download codeblocks or dev c++ ... both of these hav an inbuilt compiler & editor.. ur code is totaly fine.. try running ur code in codeblocks or dev c++ .. it should work fine..

  10. #10
    Registered User
    Join Date
    Dec 2007
    Posts
    2,675
    Please don't use an old compiler like Borland 5.5.
    Please don't use an old, buggy, unsupported IDE like Dev-C++ as suggested by our txt-speaking friend directly above, unless you opt for the up-to-date Orwell Dev-C++ that's currently being maintained.

  11. #11
    Registered User
    Join Date
    Jun 2013
    Posts
    17
    if you use devcpp .... you have the proble so am i. i use developer priview. hahahahahaha the g++ will debug autmatically

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 12-11-2012, 12:25 AM
  2. Replies: 1
    Last Post: 03-16-2010, 10:17 AM
  3. Replies: 1
    Last Post: 03-03-2009, 04:47 PM
  4. Replies: 5
    Last Post: 08-16-2007, 11:43 PM
  5. Replies: 18
    Last Post: 11-13-2006, 01:11 PM