Welcome all the time of day. I installed Qt, created a simple C ++ project, compiled it, and when I run it, the console simply opens and nothing happens.

#include <iostream> using namespace std; int main() { cout << "Hello World!" << endl; return 0; } 

What could be the problem?

==========

Reply received. Thank you kovadim

  • And what should happen? "Hello World!" and the console closes immediately. Put at the end of the program (before retourne) keyboard input or pause and then you will see the message. And where does Qt come in? You have a classic c ++ console application. - gecube
  • that's the salt that the console opens and DOES NOT close. Just hanging empty. In the Qt console status: project in progress - skad0
  • And what is the development environment? - gecube
  • well, Qt Creator - skad0
  • 2
    I repeated it myself - it works as expected (I have Fedora 18). But under Windows I remember not everything was so smooth, there qtcreator intercepted the output. Look below for "application output" - maybe your output is there. - KoVadim 5:48 pm

2 answers 2

Try instead

 int main() { cout << "Hello World!" << endl; return 0; } 

to write

 int main(int argc, char* argv[]) { cout << "Hello World!" << endl; return 0; } 

And add in the project file

 CONFIG += console 

Should help.

  • Unfortunately, it did not help. CONFIG + = console Was originally - skad0
 #include <QApplication> #include <iostream> int main(int argc, char *argv[]) { QApplication a(argc, argv); std::cout<<"Hello!"; return a.exec(); }