Forum > Beginners

How to 'Hello world' on linux



      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;

      write('Hello world');

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/ $(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.""

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 ?


"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.


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.


[0] Message Index

Go to full version