Recent

Author Topic: (SOLVED) Lazarus in Terminal?  (Read 16568 times)

guest48180

  • Guest
(SOLVED) Lazarus in Terminal?
« on: June 24, 2012, 04:41:33 am »
Is there a configuration option in the Lazarus IDE that will turn on my terminal so that a program like:

program project1;

{$mode objfpc}{$H+}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes
  { you can add units after this };

{$R *.res}

begin
  Writeln('This is Free Pascal');
  Writeln('Press enter key to close');
  Readln;
end.

will show up in my terminal? I realize this is a noob question, but I'd like for this to work the same way the tutorial does  :)

CaptBill

  • Sr. Member
  • ****
  • Posts: 435
Re: Lazarus in Terminal?
« Reply #1 on: June 24, 2012, 05:20:55 am »
Your code runs fine here. You probably need to start by using a console app project template. Go to file|new and choose "console application". Now you can delete the template code and paste yours.

You are probably trying to use the "default" template that is opened when Lazarus opens, which is a full windowed app template, which is a collection of program units, not just one like you want.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8112
  • Programming + Glam Metal + Tae Kwon Do = Me

guest48180

  • Guest
Re: Lazarus in Terminal?
« Reply #3 on: June 24, 2012, 06:04:19 pm »
Your code runs fine here. You probably need to start by using a console app project template. Go to file|new and choose "console application". Now you can delete the template code and paste yours.

You are probably trying to use the "default" template that is opened when Lazarus opens, which is a full windowed app template, which is a collection of program units, not just one like you want.


CaptBill:  My problem, even doing as you asked me to do, is that I never see a console. My terminal never pops up for me to see the output of my efforts.

jwdietrich

  • Hero Member
  • *****
  • Posts: 1036
    • formatio reticularis
Re: Lazarus in Terminal?
« Reply #4 on: June 24, 2012, 08:31:51 pm »
Which operating system do you want to run the program on?

On Mac OS X you have to open the terminal first. Then you can run the application by providing its full path name. Your code runs excellent on Mac OS X Leopard.
function GetRandomNumber: integer; // xkcd.com
begin
  GetRandomNumber := 4; // chosen by fair dice roll. Guaranteed to be random.
end;

http://www.formatio-reticularis.de

Lazarus 2.0.6 | FPC 3.0.4 | PPC, Intel, ARM | macOS, Windows, Linux

guest48180

  • Guest
Re: Lazarus in Terminal?
« Reply #5 on: June 24, 2012, 09:28:23 pm »
Which operating system do you want to run the program on?

On Mac OS X you have to open the terminal first. Then you can run the application by providing its full path name. Your code runs excellent on Mac OS X Leopard.

I'm running Linux Mint 13. I'm working a tutorial that uses the Lazarus IDE. In it it goes New | Project | Program. The tutorial does not show to select Console Program. And even if I did select this, my program runs fine but never pulls up and displays the results in the terminal. So...I have been looking in the Menu Bar for some place to activate the terminal when programs have need for it. My thinking is that when the program makes calls like Writeln and Readln that the IDE should know they're not GUI and make the default to the term. I don't really have to have the terminal, but to work through these exercises as they're shown sure would help me settle in to what's going on. Know what I mean?

Leledumbo

  • Hero Member
  • *****
  • Posts: 8112
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Lazarus in Terminal?
« Reply #6 on: June 25, 2012, 12:19:27 am »
Haven't you read my link? There should be View->Debug Windows->Terminal Output.

guest48180

  • Guest
Re: Lazarus in Terminal?
« Reply #7 on: June 25, 2012, 03:11:40 am »
Haven't you read my link? There should be View->Debug Windows->Terminal Output.

I did read your link, but in my View->Debug Windows...I don't have Terminal Output as an option. I just don't have it. I wish I did, but I don't. And it's this kind of stuff right here that makes learning this IDE (and re-learning Pascal) even more difficult. I'm not new to programming, been at is since '83. So nothing said here is over my head. But when I do a Lazarus tutorial and fail to even duplicate getting terminal output, when I do as you said and can't even find the terminal output option that you say is there, then something is wrong. I could skip the term tutorials, but there is important information in them that I'll take with me to the GUI tutorials. So I'd like to get the terminal working for these terminal programs.

I am running Linux Mint 13; Lazarus 9.30.2-2


timppl

  • Jr. Member
  • **
  • Posts: 70
Re: Lazarus in Terminal?
« Reply #8 on: June 25, 2012, 07:34:39 am »
You need to go to Run->Run Parameters and halfway down is Use Launching application. Tick the check box and put in the command line for your favourite terminal programme.

HTH
Mageia 2 Linux on x86

guest48180

  • Guest
Re: Lazarus in Terminal?
« Reply #9 on: June 25, 2012, 07:47:34 am »
You need to go to Run->Run Parameters and halfway down is Use Launching application. Tick the check box and put in the command line for your favourite terminal programme.

HTH

YES! Thank you. That was the keystone. I do appreciate the helpful insight to a problem that's been bugging me to no end. The next beer's on me  :)

Leledumbo

  • Hero Member
  • *****
  • Posts: 8112
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Lazarus in Terminal?
« Reply #10 on: June 25, 2012, 10:04:22 am »
Quote
I am running Linux Mint 13; Lazarus 9.30.2-2
OK, I see that you're using stable version which doesn't have the feature.

guest48180

  • Guest
Re: Lazarus in Terminal?
« Reply #11 on: June 25, 2012, 09:48:02 pm »
I found the solution.

Environment->Options->Debugger. Set the path and type to "none". This brings up your console program.