Important: Please read the Qt Code of Conduct -

Using QBS and precompiled headers

  • Hi All,

    I am trying to use pre-compiled headers within QBS project. However I have been hit by the issue that my project does not compile within my specific configuration. I am using VS2015.

    I am getting this error during compilation:

    macro.h:5: error: C2006: '#include': expected a filename, found 'identifier'

    Same configuration on VS project result in valid compilation, which makes me think that I am either not using the pre-compiled headers feature in QBS correctly or there is a bug with it. I was trying to find some samples to figure it out but no luck so far.

    I am attaching the sample project for reference.


    import qbs
    CppApplication {
        consoleApplication: true
    	files: [
        Group {
            name: "pch"
            fileTags: "cpp_pch_src"
            files: "macro.h"
        cpp.useCxxPrecompiledHeader: true
        Group {     // Properties for the produced executable
            fileTagsFilter: product.type
            qbs.install: true


    #include "macro.h"
    int main()


    #pragma once
    #include "macro_def.h"
    #include STDIO


    #pragma once
    #define STDIO <stdio.h>


Log in to reply