Lazarus

Using the Lazarus IDE => General => Topic started by: cemclellan on February 27, 2018, 10:11:01 pm

Title: No console when creating Simple Program Project when running on Raspberry Pi
Post by: cemclellan on February 27, 2018, 10:11:01 pm
I am running Lazarus (1.6.2) on a Raspberry Pi (Rasbian Stretch).

I am using the text "Free Pascal From Square One"

When I create a new project using the Simple Program option, the console window does not open when I run the project after successfully compiling.

If I go into the folder containing the project, I can successfully run the object code (compiled porgram).
Title: Re: No console when creating Simple Program Project when running on Raspberry Pi
Post by: cemclellan on February 27, 2018, 11:17:48 pm
Well, I have found a partial answer, in order to see my output I need to open the Console using View -> Debug Windows -> Debug Output.

However when I run the attached code, I get this result:
Eat at Joe's!
Ten Million Flies Can't ALL Be Wrong!

I do not see the unknowh characters when I run the compiled code from the command line.

Is there a way to avoid this?

Here is the code from "Free Pascal From Square One":

program EatAtJoes;

USES Crt;

begin
  ClrScr;
  Gotoxy(10,5);
  Writeln('Eat at Joe''s!');
  Gotoxy(10, 7);
  Writeln('Ten Million Flies Can''t ALL Be Wrong!');
  Readln;
end.
Title: Re: No console when creating Simple Program Project when running on Raspberry Pi
Post by: cemclellan on February 27, 2018, 11:31:45 pm
Correction to view the output I am enabling the Terminal Output:

using View -> Debug Windows -> Terminal Output

Not the Debug Output!

Still want to know why I am getting garbage on the terminal output in Lazarus when I do not when using the command line (Linux command line).
Title: Re: No console when creating Simple Program Project when running on Raspberry Pi
Post by: Martin_fr on February 28, 2018, 12:00:53 am
The "Terminal output" is a simple output. It displays the output without interpretation. (plain text)

Your code contains control sequences. (escape sequences). Those need a full terminal to interpret them.

Unfortunately there is no easy way to debug your app, AND run it in a real terminal at the same time. (It is possible, but not out of the box).
http://wiki.lazarus.freepascal.org/Debugger_Console_App
Title: Re: No console when creating Simple Program Project when running on Raspberry Pi
Post by: dbannon on February 28, 2018, 12:04:01 am
cemclellan, I don't have a RasPi with Lazarus installed so only guessing.

That 'garbage' you see looks like escape characters sent to the terminal. I assume you don't see them when you issue other command at the same terminal ? ie 'ls <enter>' ?

Maybe its coming from the Crt unit ?

How about trying to compile your source directly from the terminal ?  Save (as, eg test2.pas) -
Code: Pascal  [Select][+][-]
  1. program EatAtJoes;
  2. begin
  3.   Writeln('Eat at Joe''s!');
  4.   Writeln('Ten Million Flies Can''t ALL Be Wrong!');
  5.   Readln;
  6. end.

compile with
Code: Pascal  [Select][+][-]
  1. fpc test2.pas
Title: Re: No console when creating Simple Program Project when running on Raspberry Pi
Post by: Thaddy on February 28, 2018, 08:42:03 am
The Lazarus terminal view (Ctrl-alt-o) indeed shows that strange output. And indeed the program runs ok in an lxterminal window.  Not only on the raspberry pi!!
It may be possible to configure the IDE to use lxterminal as launching application, but I have to test that.

The Lazarus terminal view simply does not support control characters - on any platform -.
Title: Re: No console when creating Simple Program Project when running on Raspberry Pi
Post by: cemclellan on March 12, 2018, 12:11:00 am
I discovered how to enable the console application to show when running on the Raspberry Pi.

Tools >: Options > Debugger

Set Debugger Type and Path to (none).

Then the console application window will pop uo on Run (F9)
TinyPortal © 2005-2018