Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2016-05

hello world

6 messages · 4 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

M Pulis

Folks:

Apologies for the beginner nature of this query...

why won't this compile? It is the only open file and is saved, looks like a main program to me.

program Hello;
begin
   writeln ('Hello, world.');
   readln
end.

getting:

No main program found in open files. Can not build.

thanks!

Mark Morgan Lloyd
to M Pulis
M Pulis wrote 18 lines
Folks: Apologies for the beginner nature of this query... why won't this compile? It is the only open file and is saved, looks like a main program to me. program Hello; begin writeln ('Hello, world.'); readln end. getting: No main program found in open files. Can not build.

What OS are you running, what compiler version, and what's the name of your file?

$ vi hello.pas
$ fpc hello.pas
Free Pascal Compiler version 3.0.0 [2016/05/04] for arm Copyright (c) 1993-2015 by Florian Klaempfl and others Target OS: Linux for ARMHF
Compiling hello.pas
Assembling hello
Linking hello

/usr/bin/ld: warning: link.res contains output sections; did you forget -T? 7 lines compiled, 0.7 sec
$ ./hello
Hello, world.

$

Above done on a Raspberry Pi running Debian. If you're not used to this environment, $ is the shell prompt.

Notes: Example program was pasted from your mail. Ignore the message about -T. I hit return after output to satisfy the ReadLn.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]
Graeme Geldenhuys
to M Pulis: Folks: Apologies for the beginner nature of this query... why won't this compile? It is…
M Pulis wrote
No main program found in open files. Can not build.

Same as what Mark said. Give more information and paste exact compilation or runtime error.

Under FreeBSD with FPC 3.0.0

===============================================
[tmp]$ fpc hello.pas
Hint: End of reading config file /home/graemeg/.fpc.cfg Free Pascal Compiler version 3.0.0 [2015/11/16] for x86_64 Copyright (c) 1993-2015 by Florian Klaempfl and others Target OS: FreeBSD for x86-64
Compiling hello.pas
Linking hello
6 lines compiled, 0.1 sec
1 hint(s) issued
[tmp]$ ./hello
Hello world

==============================================

Regards,
Graeme

fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://fpgui.sourceforge.net/ My public PGP key: http://tinyurl.com/graeme-pgp
Tomas Hajny
to M Pulis: Folks: Apologies for the beginner nature of this query... why won't this compile? It is…

On Thu, May 5, 2016 11:38, M Pulis wrote:

Hello,

Show quoted text 6 lines
Folks: Apologies for the beginner nature of this query... why won't this compile? It is the only open file and is saved, looks like a main program to me.

.
.

getting: No main program found in open files. Can not build.

I assume that this is a message reported by some IDE tool. Which one (what's the name of the binary launched)? Could you provide a small screenshot showing the issue?

Tomas

Mark Morgan Lloyd
to Tomas Hajny
Tomas Hajny wrote 10 lines
On Thu, May 5, 2016 11:38, M Pulis wrote: > why won't this compile? It is the only open file and is saved, looks > like a main program to me. > No main program found in open files. Can not build. I assume that this is a message reported by some IDE tool. Which one (what's the name of the binary launched)? Could you provide a small screenshot showing the issue?

I can't find that message anywhere in FPC or Lazarus. OP might be doing something like targeting JVM. Android?

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]
Tomas Hajny
to Mark Morgan Lloyd
Mark Morgan Lloyd wrote 14 lines
Tomas Hajny wrote: > On Thu, May 5, 2016 11:38, M Pulis wrote: >> why won't this compile? It is the only open file and is saved, looks >> like a main program to me. >> No main program found in open files. Can not build. > > I assume that this is a message reported by some IDE tool. Which one > (what's the name of the binary launched)? Could you provide a small > screenshot showing the issue? I can't find that message anywhere in FPC or Lazarus. OP might be doing something like targeting JVM. Android?

It could be some 3rd party IDE as well. Binary name and a screenshot should clarify this.

Tomas