Program compiles but does not run

508 views
Skip to first unread message

donpro

unread,
Aug 6, 2008, 9:40:09 AM8/6/08
to multisoft FlagShip
Hi,

How does one debug when the binary executable doesn't run?
Specifically, it just returns to the command line. I've placed:

? 'text'

thoughout the code to see if/where it chokes but nothing appears on
the screen.

I am suspecting that it is a problem with the terminal type. Is there
a way to ascertain this?

Thanks.

Paul Berger

unread,
Aug 6, 2008, 10:53:26 AM8/6/08
to multisoft FlagShip
I do not believe "the program doesn't run" :-) But you (again) have
not pass all required information, so I only can reply in general:

a) store these 4 lines to file named "hello.prg" :

** hello.prg
? "hello world!"
wait
** eof

b) compile by "FlagShip hello.prg" and run in Linux Terminal by "./
a.out" for GUI mode or by "newfswin ./a.out" or "./a.out -io=t" for
textual mode

c) or compile by "FlagShip hello.prg -o hello" and run in Linux
Terminal by "./hello" for GUI mode or by "newfswin ./hello" or "./
hello -io=t" for textual mode

d) or compile by "FlagShip -d hello.prg -o hello" and run in Linux
Terminal by "./hello" for GUI mode with source-code debugger or by
"newfswin ./hello" or "./hello -io=t" for textual mode

Read the short instruction in README ("less /usr/local/FlagShip6/docu/
README") and try the examples referred there, see also how-to*
instructions.

Invoke "fsman" for FlagShip on-line manual (available also in .pdf
format) and read section FSC for compiler switches.

The common error, when the program quits immediately is:

1) not waiting for any output; use e.g. WAIT statement before your
QUIT

2) when the program consist of several modules, you either need to
specify the start module by "-Mname" switch, or as the first entry in
the compiler/linker list. Refer to fsman section FSC.1.2 to 1.6.
Alternatively, you may create Makefile semi-automatically by fsmake
available in the .../tools directory

3) wrong use of -na switch (comparable to Clipper's /N switch),
required for file-wide statics and to avoid generating of same named
UDF as the .prg name (see fsman FSC.1.3 and LNG.2.3.1)

If you have instead of above (a) source:

** hello.prg
procedure mystart // note
? "hello world!"
wait
** eof

you need to compile by "FlagShip -na -Mmystart hello.prg ..." to start
the execution in UDF mystart. With the standard "FlagShip
hello.prg ..." there is an entry point = procedure hello created
automatically. Since this UDF do nothing (no statements before UDF
mystart), the program quits immediatelly w/o any output.

Paul

donpro

unread,
Aug 6, 2008, 11:43:03 PM8/6/08
to multisoft FlagShip
Sorry. Here is some information:

System: RedHat Linux AS 5.2
Kernel: Linux lcl-rh1 2.6.18-92.1.10.el5
FlagShip: FlagShip PRO Release 6.01.19a_26 (kernel 2.6, gcc 3.x-4.x)

I have added WAIT command to the source code but it still does not run
and no WAIT prompts so I have to assume it is the compiler options.
The following Makefile was created for the application when using
FlagShip Pro 4.48 but after looking at the README, I did not note any
changes to compiler options between FS 4.498 and VFS 6.19


# ------------------------- Makefile -------------------------
# execute: $ make using the file "Makefile ****

shindexc: shindex.o shdbfp.o sysbrowd.o sysfunc.o sysvars.o
FlagShip s*.o -oshindexc

shindex.o: /exports/dev/code/shindex.prg /exports/dev/code/sh.fh
FlagShip -c -m -I/exports/dev/code /exports/dev/code/
shindex.prg

shdbfp.o: /exports/dev/code/shdbfp.prg /exports/dev/code/
sh.fh \
/exports/dev/code/shdbfp.fh
FlagShip -c -m -I/exports/dev/code /exports/dev/code/
shdbfp.prg

sysbrowd.o: /exports/dev/code/sysbrowd.prg /exports/dev/code/sh.fh
FlagShip -c -m -I/exports/dev/code /exports/dev/code/
sysbrowd.prg

sysfunc.o: /exports/dev/code/sysfunc.prg /exports/dev/code/sh.fh
FlagShip -c -m -I/exports/dev/code /exports/dev/code/
sysfunc.prg

sysvars.o: /exports/dev/code/sysvars.prg /exports/dev/code/sh.fh
FlagShip -c -m -I/exports/dev/code /exports/dev/code/
sysvars.prg

# --- eof Makefile ---------------

angelos at nospam.accpick.co.za

unread,
Aug 7, 2008, 3:00:40 AM8/7/08
to multisoft FlagShip
I think that Paul mentioned it yesterday - U do not seem to have made
mention of what the -M main_module (starting program) is in the
Makefile that has just landed in my mailbox

Does the first program possible have a function call and nothing is
calling it?

In order to validate that the compiler has been installed correctly -
why not make the simplest .prg and check if that runs?



On Aug 6, 3:40 pm, donpro <donpro-2...@rogers.com> wrote:
Message has been deleted

Paul Berger

unread,
Feb 4, 2017, 11:09:28 AM2/4/17
to multisoft...@googlegroups.com, multisoft...@googlegroups.com
Yes, this is a fault in your Makefile. The statement
  FlagShip s*.o  -oshindexc
links all s*.o objects, but it is absolutely undefined where the execution starts, it depends on the wild-card resolution. Therefore you need to use -M... switch, e.g. (assuming the start in shindex.prg):
  FlagShip s*.o -Mshindex -oshindexc
or specify the link order, e.g.
  FlagShip shindex.o shdbfp.o sy*.o -oshindexc

As Angelos and I suggested, try the output first by simple test, and read my previous posting.

Paul
Reply all
Reply to author
Forward
0 new messages