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

Robert Hairgrove evorgriahr at hispeed.ch
Sat Apr 24 23:22:31 CEST 2010


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".



More information about the Qt-creator-old mailing list