2

I'm getting started with C++ and I use Qt Creator (I run Lubuntu 13.04).

Today, as any good start with programming, I wrote my Hello World program to see if things work after installing Qt5 and Qt Creator.

I created a new Console Application project and wrote:

#include <iostream>

using namespace std;

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

Saved my project as Test, and tried to run it. I just keep getting

Starting /home/MYUSERNAME/Qt Programming/Test/Test...
Cannot change to working directory '/home/MYUSERNAME/Qt Programming/Test': No such file or directory
/home/MYUSERNAME/Qt Programming/Test/Test exited with code -1

Any ideas on how to fix this?

Thanks in advance.

3
  • 2
    I'd strongly recommend not using spaces in directory names on Linux. Also Qt isn't an IDE, it's a application framework. Qt Creator is the IDE provided with Qt.
    – dunc123
    Aug 7, 2013 at 14:38
  • qt-project.org/wiki/Qt_for_beginners_Hello_World maybe that could help you...
    – Sylvain V
    Aug 7, 2013 at 14:38
  • 1
    You should try to avoid using namespace std when possible (because names could collide), and I really don't see it being very important here, you even save some letters - but as long as you don't put such using directives in your header files I guess you're ok
    – nikolas
    Aug 7, 2013 at 14:54

3 Answers 3

0

Just maybe problem is a space in 'MYUSERNAME/Qt Programming/Test'. Anyway take a look in project build settings. Something is wrong with path where compiler is looking for your project

0

Are you sure there is a "Test" directory in the "/home/MYUSERNAME/Qt Programming/Test" directory ?

0

Using my qt4 installation I've tried starting a new Qt Console Application, chosen the folder to create project in, typed out Test for the Project name hit next, deselected Debug, but kept release. Hit next. chose none for version control, hit finish.

Program skeleton shows up. Must delete the include statement for QCoreApplication. Replace it with iostream. Deleted "QCoreapplication a" and "return a.exec". put in std::cout<<"Hello World \n"; and return 0;. Then I saved everything hit the play button and xterm is opened and displays hello world. No problems here. I even tried with spaces in directory names. Again no problems.

Then I tried creating project non-qt-project->plain c++ project. After the same menus as above, found a skeleton with exactly your code except with an endl at the end of cout statement. Hit the play button. Again no problems here. Again it opened up xterm and printed out Hello World!

Don't know what else to tell you. If you changed the name to Test AFTER you created the project, I would say, start again and this time don't change the name.

I may install qt5 on my opensuse 12.3 x86_64 installation and will be able to see if there are problems with it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.