开发者

C++ Qt framework: qmake exits with error code 2, can not find project.pro file, yet it's there

As the title says, I am having an issue with Qt Creator. I started to play with it and created a main() with a some code in it and when I wanted to compile it to see how it would appear on the screen, I am unable to 开发者_StackOverflow中文版do so, I see the following error:

Cannot find file: /Users/Eugene/Documents/Qt/Test/test.pro. Le processus "/Users/Eugene/QtSDK/Desktop/Qt/473/gcc/bin/qmake" terminated with error cade 2. Error during the compilation of the project Test (build : Desktop) during the step 'qmake'

Yet when I go to the folder, I can see the test.pro file there, so I don't see why Qt is unhappy.

Did anybody have had a similar problem? I couldn't find any similar question so far. Thanks in advance for you help, Regards


Are you sure that you don't have space or other 'weird' characters in your project's path? If so, Qt is unhappy.

You may also try to delete the *.pro.user file and try to compile again. If unfortunately neither of them work, you can try to compile your project on the command line.

cd to the root directory of your project and:

  1. qmake -project
  2. mingw32-make

If this still can't get your project compiled, you should check your Qt installation.


In my case removing non-ascii characters from the path solved the problem. Spaces are fine, at least from my experience.


I found another solution that worked for me.

QT is cross-platform tool, so it needs some limitations and restrictions. One of this restriction is correct path to project. It CAN'T contain any spaces!!!

For example

D:\Qt project\project -- wrong

is WRONG. (notice space between Qt and Project). Instead use something like this

D:\Qt_project\project -- correct

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜