Page 1 of 1

Opening a console?

Posted: Thu Nov 12, 2020 9:42 pm
by Joubarbe

Code: Select all

OpenConsole()

PrintN("Blah blah!")

Delay(5000)
That should work even if the program is not compiled in "Console" mode, right?
I'm on a Pixelbook, with the Linux beta stuff, and I cannot manage to open a console. Would be useful to do some unit tests.

Thanks.

Re: Opening a console?

Posted: Sat Nov 14, 2020 10:20 am
by Sicro
I once wished for this feature too and Fred implemented it, but in a later PureBasic (beta?) version he removed it again, because it probably caused problems.

I can not find my feature request here in the forum anymore. He apparently deleted the request after he integrated the feature.

Re: Opening a console?

Posted: Sat Nov 14, 2020 2:21 pm
by Joubarbe
Hmm? That’s a bit strange, Linux is mentioned in the OpenConsole() documentation page, and it even returns 1, so I think it should work and the problem comes from something else, like a missing package or a denied access?

Re: Opening a console?

Posted: Sat Nov 14, 2020 6:28 pm
by Paul
From HELP file...
On Microsoft Windows, there are two different executable formats: Win32 and Console. If you want to create a standard console application, like 'dir', 'del' etc. you must compile the executable using the 'Console' format (Compiler Option menu in the PureBasic IDE). On Linux and OS X, there is no special Console format however setting the Compiler option to 'Console' will launch a terminal window automatically when you run your program from the IDE.
When I test on both Linux and MacOS it works as the help file says.

Re: Opening a console?

Posted: Sat Nov 14, 2020 6:43 pm
by Joubarbe
Doesn’t work either.

Re: Opening a console?

Posted: Wed Jul 27, 2022 3:00 pm
by Marc56us
Hi all,

An answer to this old topic, because I found a solution while looking for a solution to a question on the Fr forum.

A linux application (compiled for console mode) opens a console from the IDE (after F5) only if xterm is installed.

I didn't find where this is configured, so I couldn't change this ($TERM doesn't seem to be used).

Modern distributions no longer install xterm by default, so:
debian base (ubuntu etc)

Code: Select all

$ sudo apt install xterm
Slackware

Code: Select all

$ slackpkg install xterm
Tested on PB 6.00 x64 on ubuntu and Slackware (with xfce). Test your own configuration if different.

Hope this helps
:wink:

If this setting is in the IDE code it should be possible to change it? Ideally using the $TERM system variable would allow everyone to use their terminal.

Edit: Searching through the IDE source code (purebasic-devel\PureBasicIDE\LinuxMisc.pb
Line 135) on GitHub and testing, it appears that the IDE is looking for one of the terms in order: gnome-terminal, konsole, aterm, mlterm, rxvt, xterm (?). Installing some of then then console output opens in first of them installed.

Re: Opening a console?

Posted: Tue Aug 09, 2022 5:10 pm
by W4GNS
Marc56us wrote: Wed Jul 27, 2022 3:00 pm Hi all,

An answer to this old topic, because I found a solution while looking for a solution to a question on the Fr forum.

A linux application (compiled for console mode) opens a console from the IDE (after F5) only if xterm is installed.

I didn't find where this is configured, so I couldn't change this ($TERM doesn't seem to be used).
Thank you! You have saved me a great deal of hair pulling. A note should be added to the help file