2
votes

I am using Qt Creator to rewrite my former project which is developed in Visual Studio. In this project I need to use an external library (gloox for xmpp).

Here's what I did in Visual Studio:

  1. Add c:/dir1/ to the Additional Include Directories, that's where the tons of .h and .cpp files are.
  2. Add c:/dir2/ in the linker setting, that's where the .lib file is.

I want to do the same thing in Qt Creator, so I added INCLUDEPATH += c:/dir1/ to the end of my .pro file, but when I qmaked again I still could not include anything from dir1 successfully.

#include <message.h>

C1083: Cannot open include file: 'message.h': No such file or directory

What should I do?

2
I cannot reproduce the problem... Could you please show the full output of qmake, as well as nmake VERBOSE=1 and preferably also the full project file?lpapp
Is it possible that your dir1 contains spaces? In that case, you would need to escape or quote, but it is hard to tell without the qmake output, et al.lpapp
Thank you for your comment. I spent a whole day and finally solved it. Believe it or not, here is my solution: copy everything in the .pro file and delete the .pro file. Then create a new .pro file and copy everything back, then qmake then run. I want to kill myself now......user2818068

2 Answers

0
votes

Based on the comment discussion, the problem seems to be that, after the INCLUDEPATH and potentially other relevant modifications, you forgot to properly re-run qmake.

This is necessary when dealing with QtCreator unfortunately due to the following long-standing issue:

Creator should know when to rerun qmake

0
votes

I found the solution: copy everything in the .pro file and delete the .pro file. Then create a new .pro file and copy everything back, then execute qmake then run.