Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

implicit #include statement



  • Hi all -

    A co-worker of mine asked whether Creator had the ability to include a given header file implicitly (with no #include statement in the code). This would be of use when using Creator as an editor/code browser for cross development purposes. The target uses cmake and menuconfig; it would be convenient to be able to implicitly include the sckconfig.h file that menuconfig creates, to eliminate spurious errors in Creator's editor.

    Any ideas?


  • Lifetime Qt Champion

    Hi
    Do you mean as include for the clang code completion?
    OR as a normal include for the code itself so the Creator should pretend that
    any .h or .cpp file had a #include " sckconfig.h"

    Creator does support cmake so its not possible to use that directly ?

    It sounds that you dont compile in creator so I wonder if they error you see are "just"
    from the code model plugin showing error/warnings in the side bar?



  • Hi mrjj -

    The goal is to eliminate the warnings I see in the editor. You're right that I don't actually build from Creator (though I'd love to), so it's mostly an annoyance, though it will also help me in following symbols to their origins.


  • Lifetime Qt Champion

    @mzimmers
    Ok, i assume you are using the clang code model and its those errors you see then.
    I fully understand why you want it.

    If you look at
    https://doc.qt.io/qtcreator/creator-clang-codemodel.html
    and section
    Using Compilation Databases

    I tried enabling the
    Compilation Database Project Manager (plugin) and run the Generate Database from the build menu.
    It said
    Clang compilation database generated at "xxxDebug\compile_commands.json".

    I was wondering if we somehow can add your file to this database and Creator could use the symbol from it.

    Not that i ever tried this :)


Log in to reply