Re: [Qt-creator] printf() with Qt Creator?

2010-04-26 Thread Eike Ziller

On Apr 24, 2010, at 11:51 PM, ext Danny Price wrote:

 
 On 24 Apr 2010, at 22:22, Robert Hairgrove wrote:
 
 
 This is also an issue in non-Qt apps. Just change this line:
  std::cout  test;
 to this:
  std::cout  test  std::endl;
 
 On some platforms (*nix, I think) you need to do this in order to keep 
 the next output from overwriting the line test.
 
 Thanks it now works! The CONFIG += console line appears to have no effect on 
 OSX either way. I suppose it's really for Windows?

http://doc.qt.nokia.com/4.6/qmake-variable-reference.html#config

 I've not been able to get printf to work though, even with a '\n'.
 
 ___
 Qt-creator mailing list
 Qt-creator@trolltech.com
 http://lists.trolltech.com/mailman/listinfo/qt-creator
 
 ATT1..txt

-- 
Eike Ziller
Software Engineer
Nokia, Qt Development Frameworks

Nokia gate5 GmbH
Firmensitz: Invalidenstr. 117, 10115 Berlin, Germany
Registergericht: Amtsgericht Charlottenburg, Berlin: HRB 106443 B
Umsatzsteueridentifikationsnummer: DE 812 845 193
Geschäftsführer: Dr. Michael Halbherr, Karim Tähtivuori




___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


Re: [Qt-creator] printf() with Qt Creator?

2010-04-24 Thread Danny Price
Definitely an issue here. I created a C++ project and added CONFIG += console 
to the pro file. The following does NOT print to the console until after main 
returns (as shown with a breakpoint)

#include iostream
int main()
{
std::cout  test;
return 0;
}


However if I add cout.flush() before the return, the output appears:

#include iostream
int main()
{
std::cout  test;
std::cout.flush();
return 0;
}

The CONFIG += console line appears to have NO EFFECT. This must be a recent 
regression because I'm sure this used to work. I've not been able to get it to 
work at all with stdio.h as I think it lacks a standard function to flush the 
buffer.


On 15 Apr 2010, at 08:47, Brad Hubbard wrote:

 Berk Demirkır wrote:
 A simple program output that prints a lot via printf don't show on 
 Application Output. But when i close this application output shows. Strange 
 issue...
 
 Sounds like the output buffer is not being flushed.
 
 Cheers,
 Brad
 ___
 Qt-creator mailing list
 Qt-creator@trolltech.com
 http://lists.trolltech.com/mailman/listinfo/qt-creator

___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


Re: [Qt-creator] printf() with Qt Creator?

2010-04-24 Thread Bruno Matos
Strange, as was expected, works for me. Could you please attach the  
console output of your compiler. And give the information about your  
environment.

Thank you.

On 2010/04/24, at 21:25, Danny Price wrote:

 Definitely an issue here. I created a C++ project and added CONFIG  
 += console to the pro file. The following does NOT print to the  
 console until after main returns (as shown with a breakpoint)

 #include iostream
 int main()
 {
   std::cout  test;
   return 0;
 }


 However if I add cout.flush() before the return, the output appears:

 #include iostream
 int main()
 {
   std::cout  test;
   std::cout.flush();
   return 0;
 }

 The CONFIG += console line appears to have NO EFFECT. This must be a  
 recent regression because I'm sure this used to work. I've not been  
 able to get it to work at all with stdio.h as I think it lacks a  
 standard function to flush the buffer.


 On 15 Apr 2010, at 08:47, Brad Hubbard wrote:

 Berk Demirkır wrote:
 A simple program output that prints a lot via printf don't show on  
 Application Output. But when i close this application output  
 shows. Strange issue...

 Sounds like the output buffer is not being flushed.

 Cheers,
 Brad
 ___
 Qt-creator mailing list
 Qt-creator@trolltech.com
 http://lists.trolltech.com/mailman/listinfo/qt-creator

 ___
 Qt-creator mailing list
 Qt-creator@trolltech.com
 http://lists.trolltech.com/mailman/listinfo/qt-creator

--
Bruno Matos
bruno.ma...@gmail.com




___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


Re: [Qt-creator] printf() with Qt Creator?

2010-04-24 Thread Robert Hairgrove
Danny Price wrote:
 Definitely an issue here. I created a C++ project and added CONFIG += 
 console to the pro file. The following does NOT print to the console 
 until after main returns (as shown with a breakpoint)
 
  
 #include iostream
 int main()
 {
 std::cout  test;
 return 0;
 }

This is also an issue in non-Qt apps. Just change this line:
  std::cout  test;
to this:
  std::cout  test  std::endl;

On some platforms (*nix, I think) you need to do this in order to keep 
the next output from overwriting the line test.
___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


Re: [Qt-creator] printf() with Qt Creator?

2010-04-24 Thread Danny Price
OSX 10.6.3 Leopard, Qt 4.6.2, Creator  build 1.3.83 (rev 026237b008). 

pro:

SOURCES += main.cpp
CONFIG += console


Build log:
Running build steps for project ArrayTest...
Starting: /usr/bin/make clean -w
make: Entering directory `/Users/ks/Projects/ArrayTest-build'
rm -f main.o
rm -f *~ core *.core
make: Leaving directory `/Users/ks/Projects/ArrayTest-build'
Exited with code 0.
Configuration unchanged, skipping qmake step.
Starting: /usr/bin/make -w
make: Entering directory `/Users/ks/Projects/ArrayTest-build'
g++ -c -pipe -g -gdwarf-2 -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 
-Wall -W -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED 
-I/usr/local/Trolltech/Qt-4.6.2/mkspecs/macx-g++ -I../ArrayTest 
-I/usr/local/Trolltech/Qt-4.6.2/lib/QtCore.framework/Versions/4/Headers 
-I/usr/local/Trolltech/Qt-4.6.2/include/QtCore 
-I/usr/local/Trolltech/Qt-4.6.2/lib/QtGui.framework/Versions/4/Headers 
-I/usr/local/Trolltech/Qt-4.6.2/include/QtGui 
-I/usr/local/Trolltech/Qt-4.6.2/include -I. -I../ArrayTest -I. 
-F/usr/local/Trolltech/Qt-4.6.2/lib -o main.o ../ArrayTest/main.cpp
g++ -headerpad_max_install_names -arch x86_64 -Xarch_x86_64 
-mmacosx-version-min=10.5 -o ArrayTest.app/Contents/MacOS/ArrayTest main.o 
-F/usr/local/Trolltech/Qt-4.6.2/lib -L/usr/local/Trolltech/Qt-4.6.2/lib 
-framework QtGui -L/usr/local/Trolltech/Qt-4.6.2/lib 
-F/usr/local/Trolltech/Qt-4.6.2/lib -framework QtCore
make: Leaving directory `/Users/ks/Projects/ArrayTest-build'
Exited with code 0.

(ArrayTest is just a dummy project I previously created for something else)






On 24 Apr 2010, at 22:21, Bruno Matos wrote:

 Strange, as was expected, works for me. Could you please attach the  
 console output of your compiler. And give the information about your  
 environment.
 
 Thank you.
 
 On 2010/04/24, at 21:25, Danny Price wrote:
 
 Definitely an issue here. I created a C++ project and added CONFIG  
 += console to the pro file. The following does NOT print to the  
 console until after main returns (as shown with a breakpoint)
 
 #include iostream
 int main()
 {
  std::cout  test;
  return 0;
 }
 
 
 However if I add cout.flush() before the return, the output appears:
 
 #include iostream
 int main()
 {
  std::cout  test;
  std::cout.flush();
  return 0;
 }
 
 The CONFIG += console line appears to have NO EFFECT. This must be a  
 recent regression because I'm sure this used to work. I've not been  
 able to get it to work at all with stdio.h as I think it lacks a  
 standard function to flush the buffer.
 
 
 On 15 Apr 2010, at 08:47, Brad Hubbard wrote:
 
 Berk Demirkır wrote:
 A simple program output that prints a lot via printf don't show on  
 Application Output. But when i close this application output  
 shows. Strange issue...
 
 Sounds like the output buffer is not being flushed.
 
 Cheers,
 Brad
 ___
 Qt-creator mailing list
 Qt-creator@trolltech.com
 http://lists.trolltech.com/mailman/listinfo/qt-creator
 
 ___
 Qt-creator mailing list
 Qt-creator@trolltech.com
 http://lists.trolltech.com/mailman/listinfo/qt-creator
 
 --
 Bruno Matos
 bruno.ma...@gmail.com
 
 
 
 
 ___
 Qt-creator mailing list
 Qt-creator@trolltech.com
 http://lists.trolltech.com/mailman/listinfo/qt-creator

___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


Re: [Qt-creator] printf() with Qt Creator?

2010-04-24 Thread Danny Price

On 24 Apr 2010, at 22:22, Robert Hairgrove wrote:
 
 
 This is also an issue in non-Qt apps. Just change this line:
  std::cout  test;
 to this:
  std::cout  test  std::endl;
 
 On some platforms (*nix, I think) you need to do this in order to keep 
 the next output from overwriting the line test.

Thanks it now works! The CONFIG += console line appears to have no effect on 
OSX either way. I suppose it's really for Windows?

I've not been able to get printf to work though, even with a '\n'.

 ___
 Qt-creator mailing list
 Qt-creator@trolltech.com
 http://lists.trolltech.com/mailman/listinfo/qt-creator

___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


Re: [Qt-creator] printf() with Qt Creator?

2010-04-24 Thread Coda Highland
Note that endl includes an implicit flush, so this isn't really news.

Buffered I/O is buffered I/O and you should never write code that
depends on buffered I/O being output before an explicit flush.

By the way, IIRC, fflush(stdout) should work for stdio.h I/O.

/s/ Adam

On Sat, Apr 24, 2010 at 4:51 PM, Danny Price deepblue...@googlemail.com wrote:

 On 24 Apr 2010, at 22:22, Robert Hairgrove wrote:

 This is also an issue in non-Qt apps. Just change this line:
  std::cout  test;
 to this:
  std::cout  test  std::endl;

 On some platforms (*nix, I think) you need to do this in order to keep
 the next output from overwriting the line test.

 Thanks it now works! The CONFIG += console line appears to have no effect on
 OSX either way. I suppose it's really for Windows?
 I've not been able to get printf to work though, even with a '\n'.

 ___
 Qt-creator mailing list
 Qt-creator@trolltech.com
 http://lists.trolltech.com/mailman/listinfo/qt-creator


 ___
 Qt-creator mailing list
 Qt-creator@trolltech.com
 http://lists.trolltech.com/mailman/listinfo/qt-creator



___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


Re: [Qt-creator] printf() with Qt Creator?

2010-04-14 Thread nobodyhere
thanks for the links - I will definitely read debug.html

PS: The reason I considered it Qt Creator list, is that I was specifically 
asking about stdout not showing up in the Qt Creator GUI's Application 
Output.  However, qDebug() did show up in the Qt Creator Application Output

- Original Message -
From: Sunil Thaha sunil.th...@gmail.com
To: qt-creator@trolltech.com
Sent: Tuesday, April 13, 2010 11:22:14 PM GMT -06:00 US/Canada Central
Subject: Re: [Qt-creator] printf() with Qt Creator?


This should help you - http://sector.ynet.sk/qt4-tutorial/debugging.html , 
http://doc.trolltech.com/4.6/debug.html 

BTW: This mailinglist is specific to Qt-Creator issues. You might want to post 
questions related to Qt in qt-interest mailinglist. 

Regards, 
Sunil 



On Wed, Apr 14, 2010 at 7:00 AM, nobodyhere  pem.accounts.s...@gmail.com  
wrote: 


I googled for stdout rather than printf, and I came across a special Qt 
method, qDebug(), and it works: 

#include QDebug 
qDebug(qDebug, printf style, %i\n, 5); 
qDebug()  qDebug cout style,   5; 

I'm not sure about this whole thing about using Qt's version of STL... But I 
think for this new app I'm making with Qt Designer, I probably will. 




- Original Message - 
From: nobodyhere  pem.accounts.s...@gmail.com  
To: qt-creator@trolltech.com 
Sent: Tuesday, April 13, 2010 3:21:45 PM GMT -06:00 US/Canada Central 
Subject: printf() with Qt Creator? 

I created a new Qt4 Gui Application, and did a printf(). The printf() works 
(ie, goes to the Application Output) when I run via Start Debugging F5. 
However, it doesn't print when I run via Run, Ctrl+R. :-( 
___ 
Qt-creator mailing list 
Qt-creator@trolltech.com 
http://lists.trolltech.com/mailman/listinfo/qt-creator 


___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator
___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


Re: [Qt-creator] printf() with Qt Creator?

2010-04-14 Thread Brad Hubbard
nobodyhere wrote:
 thanks for the links - I will definitely read debug.html

 PS: The reason I considered it Qt Creator list, is that I was specifically 
 asking about stdout not showing up in the Qt Creator GUI's Application 
 Output.  However, qDebug() did show up in the Qt Creator Application Output

If you want to use printf() or std::cout you need to add CONFIG += 
console to your project (.pro) file.

Cheers,
Brad
___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator


Re: [Qt-creator] printf() with Qt Creator?

2010-04-13 Thread nobodyhere
I googled for stdout rather than printf, and I came across a special Qt 
method, qDebug(), and it works:

#include QDebug
qDebug(qDebug, printf style, %i\n, 5);
qDebug()  qDebug cout style,   5;

I'm not sure about this whole thing about using Qt's version of STL...  But I 
think for this new app I'm making with Qt Designer, I probably will.

- Original Message -
From: nobodyhere pem.accounts.s...@gmail.com
To: qt-creator@trolltech.com
Sent: Tuesday, April 13, 2010 3:21:45 PM GMT -06:00 US/Canada Central
Subject: printf() with Qt Creator?

I created a new Qt4 Gui Application, and did a printf().  The printf() works 
(ie, goes to the Application Output) when I run via Start Debugging F5.  
However, it doesn't print when I run via Run, Ctrl+R.  :-(
___
Qt-creator mailing list
Qt-creator@trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-creator