PDA

View Full Version : project plain c++ without qt library



crisHerald
20th May 2013, 11:41
when i try to make this project it works normal, but nothing appears in the console window. i can ´t show a simple cout<<"hello world". someone knows what's happening?
i newbie i qt creator...

rawfool
20th May 2013, 12:07
can you post the contents of your .pro file & main.cpp file

crisHerald
20th May 2013, 20:50
#include <iostream>

using namespace std;

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





TEMPLATE = app
CONFIG += console
CONFIG -= qt

SOURCES += main.cpp



but when i try the same on windows 7 it works fine! i don know what's happening!

ChrisW67
20th May 2013, 23:37
What you have there is the generic, wizard-created "Non Qt-project, Plain C++" program.

I am assuming your first attempt was on a Linux box.

If you are running the program from inside Qt Creator then there are two possible places the output is going:

Into a terminal window that pops up, shows your program output, and waits for you to "Press <RETURN> to close this window...". This is the default created by the wizard.
Into the "Application Output" pane if the "Run in terminal" option is off. Find this option in Projects, Build & Run, Run settings.


Some terminal programs have an issue with being used in Qt Creator (e.g. KDE konsole) and, of course, one needs to be installed. Under Tools menu, Options, Environment, General tab check the "Terminal" settings. It is probably "xterm -e". If so, check that you have xterm installed or launching your program with it will fail with an error in the Program Output pane.

crisHerald
21st May 2013, 15:44
9049

screenshot
nothing appears on console .

only the cursor's mouse

ChrisW67
21st May 2013, 21:29
Some terminal programs have an issue with being used in Qt Creator (e.g. KDE konsole) and, of course, one needs to be installed. Under Tools menu, Options, Environment, General tab check the "Terminal" settings. It is probably "xterm -e". If so, check that you have xterm installed or launching your program with it will fail with an error in the Program Output pane.
I guess whatever Ubuntu is using as a terminal ("Terminal") is similarly afflicted. Change it to "xterm -e" and install xterm, or set the project to not run in a terminal as described above.

crisHerald
22nd May 2013, 16:13
i have this istalled:

x-terminal-emulator -e

is the right terminal? how can i download the right?

ChrisW67
22nd May 2013, 21:18
Replace that with:

xterm -e
If nothing happens because xterm is not installed:

sudo apt-get install xterm
Or use whatever Ubuntu's graphical package manager is to do the same thing.

Then find a Ubuntu beginners' guide and read some of it.
http://ubuntu-manual.org/
http://www.ubuntupocketguide.com/