Results 1 to 7 of 7

Thread: My helloworld program doesn't compile

  1. #1

    My helloworld program doesn't compile

    I'm new to Pascal and I'm learning it using the Free Pascal compiler. I thought of starting with a helloworld program so I wrote this program:

    Program helloworld ;

    Begin

    writeln ('Hello World') ;
    readln ;

    End.

    The program compiled with no problems. Then I thought of adding a variable so I wrote this program:

    Program helloworld ;

    var

    x : integer ;

    Begin

    x := 1 ;

    writeln ('Hello World') ;
    readln ;

    End.

    The program didn't compile and I got an error message. I don't understand why I simply added a variable. What should I do exactly?

  2. #2
    PGD Community Manager AthenaOfDelphi's Avatar
    Join Date
    Dec 2004
    Location
    South Wales, UK
    Posts
    1,245
    Blog Entries
    2

    Re: My helloworld program doesn't compile

    Well, first up, welcome to PGD Polar.

    I'm no FreePascal expert, having never used it, but what you've got is pretty standard Pascal so I should be able to help... unfortunately, I can't because I can't see anything wrong with the code.

    So, is it an error you're getting or is it a warning... possibly something like 'The value assigned to X is not used'?

    Whatever, we will need more information, mainly the exact messages returned by the compiler if we are to help you.
    :: AthenaOfDelphi :: My Blog :: My Software ::

  3. #3

    Re: My helloworld program doesn't compile

    what's the error message?
    From brazil (:

    Pascal pownz!

  4. #4

    Re: My helloworld program doesn't compile

    The error message says: Compile failed. Also it tells me that there are 2 errors. I don't get it my code doesn't seem to have errors.

  5. #5

    Re: My helloworld program doesn't compile

    Welcome to PGD Polar... I only use FreePascal and might be able to help. Though going through you're code I don't see anything wrong. Like Athena said, it's basic pascal. Please tell us what error messages did the compiler return.

  6. #6

    Re: My helloworld program doesn't compile

    It could be useful to tell us some other infos, e.g. your fpc version, your OS and so on. Another tip is to compile with
    [code=delphi]fpc -va helloworld.pas > out.txt[/code]

    and to put somewhere the file out.txt.
    Get your fpc4gba copy now!
    Get your fpc4nds copy now!

  7. #7

    Re: My helloworld program doesn't compile

    Oops! it seems that I deleted one of the ; symbols by mistake before compiling. I've added it again and now the program compiles with no problems. Thank everybody for your friendly responses and hopefully now I can make some progress in learning Pascal.

Bookmarks

Posting Permissions

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