There is no point in precompiling headers if you are not compiling any actual code, right?
I think you got it the wrong way. This is not used for projects you already have compiled but rather for projects you wish to compile. And it's not a mechanism for gathering many files into a single file but for speeding up processing header files by the compiler. You still need to have the actual header files should you wish to rebuild the pch file (i.e. when you want to add some more files to the database).How would I use this for e.g. QExtSerialport ?
In theory you can reuse the precompiled header for other projects but it only makes sense if you always use the same set of header files which is rarely the case. Of course unless you like having a several hundred megabyte file lying around on your disk and being read during every compilation cycle (taking up time and memory).Or can the .pch file be put in some common place and be re-used across projects ?
Well, for Qwt it wouldn't make sense really. Unless you like to have your applications build several times longer. The larger the header file, the longer it takes for the toolchain to preprocess it. We rather want to avoid having to include files than including to many of them. There is a simple test - make a small Qt project consisting just of main() that creates a QString. Then include <QString> compile and measure the compilation time. Then replace <QString> inclusion with <QtCore> and rebuild, measuring time again (just using an appropriate system call and not your stopwatch). If you don't see a significant difference, replace <QtCore> with <QtGui> and add some more includes and then repeat the compilation cycle and measure the time again. Then draw conclusions from your observations and think whether you want that for all your projects.I would use it for just this kind of libraries, of which there are dozens available on the internet : QExtSerialPort, Qwt, QSerialDevice, AnalogWidgets, ...
So what makes a "standard header file" different than "include file of the library itself"?Of course I would only combine the include files of the library itself together, not the standard header files like stdarg.h. Hey, I'm not (that) stupid
Yes..pri files are new to me also. As far as I understand, they are just files that are included in your .pro file. So how would I use these ? Create a .pri file for QExtSerialPort that adds the necessary include file paths for where I put QExtSerialport.
No, you can put that anywhere you want as long as you know where it is.Put this .pri file in the Qt include directory.
Yes.Reuse this .pri file in different projects of mine ?
Bookmarks