Forum > Options

in the IDE not getting an output

<< < (2/3) > >>

Thaddy:
source code

phantom21:
I've written some simple source code for testing and retraining myself.  It works completely nad properly in the CLI IDE, but, while it is EXACTLY the same in the GUI (Lazarus) IDE and compiles, it does not show the output.  Here's the code.
PROGRAM Test_While ;

VAR
  x, y : INTEGER;

  PROCEDURE Loop(inner, outer: INTEGER) ;

  VAR
  inner1 : INTEGER ;

  BEGIN

    WHILE outer > 0 DO
    BEGIN
      inner1 := inner ;

      WHILE inner1 > 0 DO
      BEGIN
        WRITE('outer = ', outer);
        WRITELN('   inner = ', inner1);
        inner1 := inner1 -1 ;
      END ;
      outer := outer - 1 ;

    END ;
  END ;

BEGIN

  x := 4;
  y := 7;

  Loop(x,y);
  READLN ;

END.             

rvk:

--- Quote from: phantom21 on February 09, 2018, 04:26:28 pm ---It works completely nad properly in the CLI IDE, but, while it is EXACTLY the same in the GUI (Lazarus) IDE and compiles, it does not show the output.
--- End quote ---
How did you "create" this GUI program?

If you did it in Lazarus and just copied the code you should have gotten an error.

You can't just use writeln() in a GUI program.

Just begin with creating a propper GUI-application with Project > New Project and choose Application.
Go from there. (But note that GUI-programming is completely different from console-programming)

taazz:
start the lazarus IDE go to the menu project\New Project on the dialog that appears select "simple program" copy the code you posted here and paste it in the unit created then run. Does it create any output?
--- Quote from: rvk on February 09, 2018, 04:49:45 pm ---
--- Quote from: phantom21 on February 09, 2018, 04:26:28 pm ---It works completely nad properly in the CLI IDE, but, while it is EXACTLY the same in the GUI (Lazarus) IDE and compiles, it does not show the output.
--- End quote ---
How did you "create" this GUI program?

If you did it in Lazarus and just copied the code you should have gotten an error.

You can't just use writeln() in a GUI program.

--- End quote ---
I thought that in linux there is no differenc between gui and console all applications where console applications they just did not open the console window by default.

rvk:

--- Quote from: taazz on February 09, 2018, 04:51:38 pm ---I thought that in linux there is no differenc between gui and console all applications where console applications they just did not open the console window by default.

--- End quote ---
Ha, yes, you're correct. I see there is no error given under Linux.

I also see now what phantom21 means by not having a console window in Lazarus IDE when running a simple console application. It doesn't appear automatically like in Windows.

@phantom21, you can choose View > Debug Windows > Terminal Output or press Ctrl+Alt+O to get the window you want with your output/input.

The other option is Run > Run parameters and check the "Use launching application" checkbox.
(it's in the wiki: http://wiki.freepascal.org/Console_Mode_Pascal)

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version