PDA

View Full Version : config += console for mac



jcr
25th August 2006, 19:39
Hello,
On windows my .pro file contains the line
CONFIG += console
which is convenient to display some info on the console using std::cout <<
I have ported some codes to the Mac (OSX) and I was naively expecting to see the data on the terminal window... Well the terminal window remains blank and the data are lost in the universe... Any idea on how to port that section of the code?
Thanks

Brandybuck
26th August 2006, 02:09
You need the "console" option under Windows because that's the only way to get standard C++ I/O. But you don't need that under Unix or the Mac. Just run it from a terminal window and you'll automatically get normal stdin/stdout behavior.

Because Macs use application bundles, you need to use the "open" command to launch them from the terminal:

open myapp.app

Matt Smith
28th August 2006, 11:23
You need the "console" option under Windows because that's the only way to get standard C++ I/O. But you don't need that under Unix or the Mac. Just run it from a terminal window and you'll automatically get normal stdin/stdout behavior.

Because Macs use application bundles, you need to use the "open" command to launch them from the terminal:

open myapp.app

You need to suppress bundle production on the Mac, by adding this line to your .pro file:

CONFIG-=app_bundle

It is in the deployment documentation; see here (http://doc.trolltech.com/4.1/deployment-mac.html).