# wtf? hello world not working :S pascal programming help wanted!



## cammi (Jan 9, 2003)

As I said earlier, freepascal.org doesn't work, so I downloaded Bloodshed Dev-Pascal. Just to try it out, I did the Hello World thing. This is my program:

program HelloWorld;
begin
writeln('Hello World!');
writeln;

writeln('Press any key to continue');
readln;
end.

What's wrong with it? *confuzzled*


----------



## cammi (Jan 9, 2003)

ummm any one?


----------



## Shadow2531 (Apr 30, 2001)

I'll give it a shot.


----------



## Shadow2531 (Apr 30, 2001)

Use this format

Program HelloWorld(InPut,OutPut);
Begin
WriteLn('Hello World!');
End. { HelloWorld }

I downloaded dev-pascal with the GNU compiler.
http://www.gnu-pascal.de/contrib/chief/win32/dev_gnu_pascal-1.9.2.exe

All the included examples won't compile.

The HelloWorld example that comes with it wouldn't compile either. Probably just old non-standard examples.

Basically what that boils down to is, you have to have everything perfect or it won't compile. That's the way it should be though.

Hope that helps.

If it still doesn't work, run setgcp.bat in the dev_gpc folder.


----------



## Shadow2531 (Apr 30, 2001)

I found another weird thing. Just using the code I posted about isn't what made it compile.

The only way I can get that code to compile is if I set up the .pas extension to open with devpas.exe. Then use notepad and type the code in. Save it as a helloworld.pas.

Then double-click on helloworld.pas.

If you load the file that way, the code will look like this.

*Program* HelloWorld(InPut,OutPut);
*Begin*
WriteLn('Hello World!');
*End.* { HelloWorld }

If it doesn't show the colors like that, then it won't compile.

Dev c++ doesn't have those problems.

Not sure what OS, you are using, but for Windows, you have to create a new file type because dev-pascal doesn't set it up.

MyComputer
Tools
Folder Options
File Types
New
file extension = *.pas*
no need to click on advanced
click ok
goto the extension
click the "change" button
select c:\dev_gpc\devpas.exe for the program to open that extension.

Then you will have to create your programs in notepad, save them with a .pas extension, double-click them.

That will load up Dev-Pascal.

Then you click on Execute, then "compile and run"

Since the executable will be a console program, you will either have to add a system pause in the program to actually see the output or load a console window and run the executable.

All that defeats the purpose of the IDE, which is a good thing, since it's just easier to use the command line.

You can also do this (the command line way)

First make your program and save it with a .pas extension to the c:\dev_gpc\bin directory.

Load a console window. (aka ms-dos prompt)
change to the c:\dev_gpc directory
run "setgpc.bat
change to the c:\dev_gpc\bin directory
now you can use gpcc.exe to compile the pas file.

For example

*gpcc helloworld.pas*

That will output helloworld.exe which is what you want.

Now matter how you do things, if Dev-Pascal isn't displaying the colors of the text properly, then it won't compile. If it displays the colors it still might not compile if you create a project, because there will be an error in the resource file.

It might be a path problem.

_________________________________

Ok got it. It is a path problem.
When you create a project, save it to c:\dev_gpc\bin

Then it will compile fine.

So your original code of

program hello;
begin
WriteLn('hello');
end.

should work fine.

If you want to clear dev-pascals recent files list, edit devpas.ini and delete the history and history open entries.


----------



## cammi (Jan 9, 2003)

thanks 

do you have a good free pascal program that you recommend me downloading?


----------



## Shadow2531 (Apr 30, 2001)

Not sure, that was my first time doing pascal.

However I would go to http://www.gnu-pascal.de/binary/mingw32/

On that page I would download GPC 2.1. (it's the first link). That's basically what's in the bin directory of dev-pascal. It will be command-line, but that's what I would try.

I will try it soon and let you know.

Also, on that page, if you notice the third link is a patch that is supposed to fix path issues. It say's it's only for win9x users, but it might work for other. So that patch might fix dev-pascal to compile in any directory.


----------

