Recent

Author Topic: MacOS "Hello, World." Console Problems  (Read 2171 times)

c_knowles4834

  • New Member
  • *
  • Posts: 23
MacOS "Hello, World." Console Problems
« on: August 02, 2021, 09:57:21 pm »
Hey fellas,

I finally got Lazarus to run properly without any errors; however, I am trying to go through Marco Cantù book on Object Pascal and have run into a problem.

When trying the first program in the book, I cannot get the console to appear and display "Hello World."

Below is the program I am running:

Code: Pascal  [Select][+][-]
  1. program HelloConsole;
  2.  
  3. {$APPTYPE CONSOLE}
  4.  
  5. var
  6. strMessage: string;
  7.  
  8. begin
  9. strMessage := 'Hello, World';
  10. writeln (strMessage);
  11. readln;
  12. end.

I omitted "{$APPTYPE CONSOLE}" due to a message that stated that it was not supported by my target OS and now it says the program ran successfully.  But, I still cannot get a console window to display. 

Any ideas on how to solve this issue?


[Edited to add code tags - please read How to use the Forums.]
« Last Edit: August 03, 2021, 01:16:06 am by trev »

howardpc

  • Hero Member
  • *****
  • Posts: 3753
Re: MacOS "Hello, World." Console Problems
« Reply #1 on: August 02, 2021, 10:24:32 pm »
Try pressing Ctrl+Alt+O in the IDEorView -> Debug Windows -> Console In/Output

c_knowles4834

  • New Member
  • *
  • Posts: 23
Re: MacOS "Hello, World." Console Problems
« Reply #2 on: August 02, 2021, 10:39:57 pm »
Lazarus didn't respond to CTLR+OPT+O, and I don't have a "Console In/Output" in "Debug Windows". 

See image attached:

Seenkao

  • Full Member
  • ***
  • Posts: 213
Re: MacOS "Hello, World." Console Problems
« Reply #3 on: August 02, 2021, 11:38:17 pm »
Похоже вы создали приложение Lazarus (LCL)?
Изначально надо создавать обычное приложение (не LCL),  в этом случае ошибки  появляться не должно ({$APPTYPE CONSOLE}).

google translate:
Sounds like you've created a Lazarus Application (LCL)?
Initially, you need to create a normal application (not LCL), in this case, no errors should appear ({$ APPTYPE CONSOLE}).

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1580
  • Former Delphi 1-7, 10.2 user
Re: MacOS "Hello, World." Console Problems
« Reply #4 on: August 03, 2021, 01:48:31 am »
1. Project > New Project - Choose simple program
2. Enter FPC code
3. Tools > Options > Debugger > Debugger backend - Toggle LaunchNewTerminal to True
    =or for Lazarus 2.2 RC1 or trunk or fixes 2.2=
    Lazarus > Preferences > Debugger > Debugger backend - Toggle LaunchNewTerminal to True
4. Compile and run.

See attached pic for result.

Note: {$APPTYPE CONSOLE} is not supported by macOS. It does no harm, but has no effect.
« Last Edit: August 03, 2021, 01:52:41 am by trev »
Lazarus 2.3 2021-08-10 FPC 3.3.1 r49223 macOS 10.14.6 Xcode 11.3.1
Lazarus 2.3 r65500 FPC 3.3.1 r49634 macOS 11.5.2 aarch64 Xcode 12.5.1
Lazarus 2.3 2021-08-11 FPC 3.2.2 FreeBSD 13.0 amd64 VMware VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 Parallels VM
Lazarus 2.0.10 FPC 3.2.0 Win10 Parallels VM

 

TinyPortal © 2005-2018