Disable Terminal for Command Line Tool - xcode

I programm an artificial life simulation on my mac with Xcode in C++/OpenGL.
Due to the fact that my programm has a visual output in a seperated window,
I do not need the terminal, while running the concrete programm.
Nevertheless the terminal opens when I run my application throwing '/path/programm ; exit;' at its user. I guess that is for debuging? Or maybe standard because it is a command line tool?
So if I want to make a proper looking application out of it, which does not bother its users with command line outputs, what do I have to do?
If it is inherent of the command line tool to open the terminal do I have to migrate the source code to a cocoa app or Qt even though I yet do not need these build interfaces?
Thank you for your effort.

If I understood your question right, you don't want the terminal to be shown when the user double-click your app ?
In this case you should create a .app bundle and embed your binary into it.
I just tested with the basic "Hello world" Xcode command line template, it works fine.

You can use
#echo off
In the part off your code that requires the terminal.

Related

Is it possible to output on multiple terminal windows within a single program?

This question is very close to the following question:
Is it possible to output on multiple terminal windows within a single C program?
Yeah, I removed the the letter c. The above link shows how to do this on linux.
I was wondering, can this be done on windows and osx as well?
And if so how?
And also, can it work with "third party" terminals, like iTerm on osx or cmder on windows?
The language preferred to achieve this is java, but not required.
if i correctly understand, you need to create pipe to the terminal window, in order to send data to it. If found a link for you, which may help. spawning a new terminal and writing to its output

Show traces on mac terminal

I'm trying to use the Atom IDE to make some Haxe project on my new Mac (as a Windows user, I'm discovering this world), and I install the package "haxe" to do this. Until there, all is perfect (great jobs to them \o/), and I can compile an swf :).
But I have a little problem, even with the "-debug", all my traces are in the swf, not on the output console (terminal if I run from it, or output panel on Atom). Maybe I've forget to do/install/init something ?

Ruby and GTK3 without console window in background

Hello Stackoverflow user's. this is my first question. :)
I'm using ruby and gtk3 to make a few GUI's for scripts that I use a lot. The problem I'm having is that when I run the script it opens the console window as well as the GUI, which in my mind defeats the purpose of a GUI.
I'm currently trying to run the scripts by executing them on my desktop.
I tried packaging it inside OCRA but that generated a lot of errors. I don't mind packaging or running the script directly as long as it doesn't open a console window, or at the very least closes it when it launches.
I'm using windows, and ruby 2.0.x.
Basically I don't want a DOS console window to open when I run my script.
I'm intermediate with ruby so please, clear instructions and simple solutions.
Thanks in advance.
Found a simple solution. Save the script with .rbw extension instead of .rb extension.
Hopefully this will help other newbies.

When I try to launch a script, it opens and then immediately closes

I am trying to make a simple ruby script. However, when I run it, the command line opens, and closes almost immediately. I had the same problem with a visual basic console application, so I'm not sure if this is a problem with command prompt.
I am running Windows 8 with Ruby 1.9.3. Any help is appreciated.
This is a common symptom when developing command line applications on Windows, especially when using IDEs.
The correct way to solve the problem is to open the command line prompt or PowerShell manually, navigate to the directory where the program is located and execute it manually via the command line:
ruby your_program.rb
This is how command line programs were designed to be executed from the start. When you run your code from an IDE, it opens a terminal and tells it to execute your program. However, once your program has finished executing, the terminal has nothing to do anymore and thus closes.
However, if you open the terminal, then you the one telling it what to do, not the IDE, and thus the terminal expects more input from you even after the program has finished. It doesn't close because you haven't told it to close.
You can also use this workaround at the end of your Ruby script:
gets
This will read a line from standard input and discard it. It prevents your program, and thus the terminal, from finishing until you've pressed return.
Similar workarounds can be used in any language such as C and C++, but I don't think they are solving the actual problem.
However, don't let this discourage you! Feel free to use gets while you are learning. It's a really convenient workaround and you should use it.
Just be aware that these kinds of hacks aren't supposed to show up in production code.
Are you running from the command line or as an executable. Try placing a busy loop at the end to see the output or wait for keyboard input. If you run outside a command line the command line exits upon completion of the script.

Win GUI App started from Console => print to console impossible?

this is not yet another "I need a console in my GUI app" that has been discussed quite frequently. My situation differs from that.
I have a Windows GUI application, that is run from a command line. Now if you pass wrong parameters to this application, I do not want a popup to appear stating the possible switches, but I want that printed into the console that spawned my process.
I got that far that I can print into the console (call to AttachConsole(...) for parent process) but the problem is my application is not "blocking". As soon as I start it, the command prompt returns, and all output is written into this window (see attached image for illustration).
I played around a bit, created a console app, ran it, and see there, it "blocks", the prompt only re-appears after the app has terminated. Switching my GUI app to /SUBSYSTEM:Console causes strange errors (MSVCRTD.lib(crtexe.obj) : error LNK2019: nonresolved external Symbol "_main" in function "___tmainCRTStartup".)
I have seen the pipe approach with an ".exe" and a ".com" file approach from MSDEV but I find it horrible. Is there a way to solve this prettier?
This is not behaviour that you can change by modifying your application (aside from re-labelling it as already discussed). The command interpreter looks at the subsystem that an executable is labelled with, and decides whether to wait for the application to terminate accordingly. If the executable is labelled as having a GUI, then the command interpreter doesn't wait for it to terminate.
In some command interpreters this is configurable. In JP Software's TCC/LE, for example, one can configure the command interpreter to always wait for applications to terminate, even GUI ones. In Microsoft's CMD, this is not configurable behaviour, however. The Microsoft answer is to use the START command with the /WAIT option.
Once again: This is not the behaviour of your application. There is, apart from relabelling as a TUI program, no programmatic way involving your code to change this.
Maybe write a console-based wrapper app that checks the parameters, prints the error message on bad parameters, and calls/starts up the actual program when the parameters are correct?

Resources