The terminal window fills with text that can only be some kind of error but it happens after the last sleep command in my program.
It shuts immediatly and I can't figure out what it is saying. I can't retrieve that window.
I have tried compiling from the terminal but it doesn't fill the terminal with text in that case.
How do I stop that terminal window from closing after my run?
Ubuntu
Terminal closes too quickly
Terminal closes too quickly
Last edited by sancho3 on Mar 28, 2018 4:55, edited 1 time in total.
Re: Terminal closes too quickly
What operating system? Since you use the word Terminal I'm assuming Linux. In order to keep the terminal window open you need to run your application from the terminal prompt.
Re: Terminal closes too quickly
Thanks.
I found the error in my program.
It seems rather pointless to fill a terminal window with debug info and then shut it down.
Running from terminal gives one line error, Segmentation violation. Its some help, but not much.
I found the error in my program.
It seems rather pointless to fill a terminal window with debug info and then shut it down.
Running from terminal gives one line error, Segmentation violation. Its some help, but not much.
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: Terminal closes too quickly
If you need more info try this:sancho3 wrote:Running from terminal gives one line error, Segmentation violation. Its some help, but not much.
fbc -exx yourcode.bas
./yourcode
or use the debugger:
fbc -g yourcode.bas
gdb ./yourcode
[r] <-- means press r for run
Joshy
Re: Terminal closes too quickly
Hi All
I had only ever used -exx to check for array bounds.
Whenever I tried to run the program compiled with -exx with Win or Dos it would hang or not run.
Mind you this was years ago.
Actually found an error that has gone unnoticed when I just tested this.
Thank you Joshy
Regards
Another note for my Linux tricks notebook.If you need more info try this:
fbc -exx yourcode.bas
./yourcode
I had only ever used -exx to check for array bounds.
Whenever I tried to run the program compiled with -exx with Win or Dos it would hang or not run.
Mind you this was years ago.
Actually found an error that has gone unnoticed when I just tested this.
Thank you Joshy
Regards
Re: Terminal closes too quickly
Definitely essential tips from Joshy. During the development phase, -exx should always be used, as should -g. And you should always run your app from the terminal also. Don't rely on double-clicking an icon as you'll miss vital information. I'm a bit surprised you even saw a terminal window pop up. On my desktop, double-clicking an executable runs it without any standard I/O streams at all, which means a non-graphical FB program would probably do appear to do nothing at all. On your distro it must be defaulting to running executables in a terminal window, which is reasonable for normal terminal apps I suppose.
One thing I like about Linux over Windows is that all applications can use standard out and standard error, but it's always hidden unless you run it from a terminal directly. This is great as normal users would never see or be bothered by information, but if someone wants it, it's there when they run it from a terminal. Unlike Windows where if you use standard out or standard error at all, it pops up an annoying console window. This means you have to make your program completely silent for production applications.
One thing I like about Linux over Windows is that all applications can use standard out and standard error, but it's always hidden unless you run it from a terminal directly. This is great as normal users would never see or be bothered by information, but if someone wants it, it's there when they run it from a terminal. Unlike Windows where if you use standard out or standard error at all, it pops up an annoying console window. This means you have to make your program completely silent for production applications.
Re: Terminal closes too quickly
On Windows, you can build it as a gui app and then use AllocConsole if a switch is present.caseih wrote:One thing I like about Linux over Windows is that all applications can use standard out and standard error, but it's always hidden unless you run it from a terminal directly. This is great as normal users would never see or be bothered by information, but if someone wants it, it's there when they run it from a terminal. Unlike Windows where if you use standard out or standard error at all, it pops up an annoying console window. This means you have to make your program completely silent for production applications.
Alternatively, you can build as a console app and use FreeConsole to get rid of the console.
Re: Terminal closes too quickly
With Geany you can do this (Linux or Windows):
Now, in this case:
F8 = Compile with extra checks
F9 = 'Normal' compile (faster)
F5 = Run
Now, in this case:
F8 = Compile with extra checks
F9 = 'Normal' compile (faster)
F5 = Run
Re: Terminal closes too quickly
Using -exx for array bounds check and: viewtopic.php?t=25835#p234749
Re: Terminal closes too quickly
Good tip about GDL, I forgot I could use that from the terminal or even in the IDE.
I did use -exx. I absolutely use that all the time. I am running from within the IDE (poseiden on Ubuntu) normally, and FB produces a terminal window and a graphic window if you use screenres.
In this case the terminal window was filling with debug info and running from the command line would only give the limited error message.
At the end of the day the problem was in a destructor and if I had been diligent I would have found it much sooner.
I did use -exx. I absolutely use that all the time. I am running from within the IDE (poseiden on Ubuntu) normally, and FB produces a terminal window and a graphic window if you use screenres.
In this case the terminal window was filling with debug info and running from the command line would only give the limited error message.
At the end of the day the problem was in a destructor and if I had been diligent I would have found it much sooner.