Recent

Author Topic: How to 'Hello world' on linux  (Read 1207 times)

FramX

  • Newbie
  • Posts: 3
How to 'Hello world' on linux
« on: December 02, 2023, 09:34:57 pm »
Hi,

      I wanted to write a hello world program but it doesn't open in a terminal, i can only see the output through a console that
      pops up and in the video that i'm following says that there should be an executable in the folder of the project but it does
      nothing for me. How do i get it to work right?. I'm on kde Neon if that matters.

This is the code:

program project1;

begin
      write('Hello world');
      readln;
end.         

FramX

  • Newbie
  • Posts: 3
Re: How to 'Hello world' on linux
« Reply #1 on: December 02, 2023, 10:35:15 pm »
after looking around for a solution i found this settings,  Run->Run Parameters->Use Launching application, and after ticking the box i got this line -> /usr/bin/konsole -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine).

i saved and tried running the code againt and got this message

Debugger error
Ooops, the debugger entered the error state
save your work now!
Hit stop, and hope for the best, we're pulling the plug.
the debugger could not set a breakpoint on the application's entry point.
this may be caused by missing debug info.


The GDB command:
"info address main"
returned the error:
",msg="No symbol \"main\" in current context.""

dbannon

  • Hero Member
  • *****
  • Posts: 3156
    • tomboy-ng, a rewrite of the classic Tomboy
Re: How to 'Hello world' on linux
« Reply #2 on: December 03, 2023, 12:24:51 am »
Fram, the reason that your output shows up in the "console" is that you are running it in the IDE, a GUI app.

If you want to see the result appear at the command line, then start the app you made, at the command line. It will almost certainly be called "project1" and will be the only executable file in your working directory. If you compile and link without an error (and that code should compile), then an executable will definitely be made, perhaps you are not looking in the right place ?

Davo
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

wp

  • Hero Member
  • *****
  • Posts: 12459
Re: How to 'Hello world' on linux
« Reply #3 on: December 03, 2023, 12:44:08 am »
"View" > "Debug Windows" > "Console In/Output" brings up a redirected console window (also called "Terminal Output" in older versions), and here you can see the output while the application is running inside the IDE.

See https://www.youtube.com/watch?v=e_mztrfDGhE

FramX

  • Newbie
  • Posts: 3
Re: How to 'Hello world' on linux
« Reply #4 on: December 05, 2023, 07:39:07 pm »
Thanks for the replies i found the problem, following the instructions on the video i was watching i changed one of the options in options > debugger > debugger backend > debugger type and path, i was using GNU debugger and after changing it to FpDebug it opened the program on the terminal.

 

TinyPortal © 2005-2018