Recent

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

c_knowles4834

  • New Member
  • *
  • Posts: 25
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: 3834
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: 25
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

  • Sr. Member
  • ****
  • Posts: 261
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: 1683
  • 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, FPC 3.3.1 macOS 12.0.1 x86_64 Xcode 13.1
Lazarus 2.3, FPC 3.3.1 macOS 12.0.1 aarch64 Xcode 13.1
Lazarus 2.3, FPC 3.2.2 FreeBSD 13.0 amd64 VM
Lazarus 2.3, FPC 3.2.2 FreeBSD 12.2 amd64 VM
Lazarus 2.1 r61574 FPC 3.0.4 Ubuntu 20.04 VM
Lazarus 2.0.10 FPC 3.2.0 Win10 VM

 

TinyPortal © 2005-2018