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.

    include_macro_test.qbs

    import qbs
    
    CppApplication {
        consoleApplication: true
    	files: [
            "macro_def.h",
            "main.cpp",
        ]
    
        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
        }
    }
    

    main.cpp

    #include "macro.h"
    
    int main()
    {
        printf("test");
    }
    

    macro.h

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

    macro_def.h

    #pragma once
    
    #define STDIO <stdio.h>
    

    Thanks,
    Boleslaw


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.