Recent

Author Topic: No console when creating Simple Program Project when running on Raspberry Pi  (Read 4479 times)

cemclellan

  • Newbie
  • Posts: 4
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).

cemclellan

  • Newbie
  • Posts: 4
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.

cemclellan

  • Newbie
  • Posts: 4
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).

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9793
  • Debugger - SynEdit - and more
    • wiki
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

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
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
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Thaddy

  • Hero Member
  • *****
  • Posts: 14204
  • Probably until I exterminate Putin.
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 -.
« Last Edit: February 28, 2018, 08:44:39 am by Thaddy »
Specialize a type, not a var.

cemclellan

  • Newbie
  • Posts: 4
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