Important: Please read the Qt Code of Conduct -

warning: this file is not part of any project.

  • Hi!
    I am tried to migrate from Ubuntu to Windows machine with my small project, but every time when i am import my project i see in QT error message: warning: this file is not part of any project.....

    When CMake ended refreshing this message is hide, but code mode not working. I can create build or add some new code and build again, but code mode is off :(
    My systems is:
    Windows 10 home
    QT 4.9.2
    CMake 3.15.0-rc3
    MinGW installed separately from QT (gcc version 8.2.0 ( GCC-8.2.0-3))

    if needed, i can share my project from gitlab

  • @tereshko Faced the same when I migrate from Windows to Ubuntu. I guess it is an issue about the user configuration conflicts among the operation systems.
    I remember, I solved this issue by creating a new Qt project (creating the whole files again one-by-one) and copying the content to them :D
    I wish you luck!

  • Lifetime Qt Champion


    You should make sure that no build artifacts or configuration files from the other system are copied over to the new systems.

    Especially, Creators *.user files should never be shared.

    Also, when transferring between Unix and Windows, the case sensitivity of path and file names is different. So #include "Empty.h" will fail on Unix if the file is namend empty.h. Should be no problem in your case, but you may check that too.


  • ok, i will try. Thnaks

  • @aha_1980
    nono, i have only CMake file, *.h and *cpp

  • Hey, I've got a similiar (if not THE same issue) but I didn't migrate from windows.
    The point is, I managed it once to create a C++ file and found it in the correct place within QT, but I consider this as lucky shot.

    So It doesn't matter where I create the new C++ file, it never appears in the Header directory - but in the <Headers> Section, which is... kind of another project...thing?
    Sorry for the noob question.

    Any help would be highly appreciated

    Screenshot from 2021-09-29 14-17-54.png

  • Lifetime Qt Champion

    @Meistermosher It look to me like you added systemcontroller.cpp and systemcontroller.h to the qml.qrc resource file! Why?

  • @jsulm Yeah that's the question x)
    I hope I managed it so far (the right way):

    I rightclicked on "Source FIles" and chose "Add new" and created the C++ file.
    After this I attached it to the "project: qml.qrc Prefix:/" which was "Thermostate" for obviously no reason
    (but... this is wrong?)
    And THEN I edited the CMakeList.txt and added the file manualy.

    And now it works...

    I hope this is (a) correct way of doing it- anyway the Error is gone.

    Screenshot from 2021-09-29 14-50-03.png

  • Lifetime Qt Champion

    @Meistermosher said in warning: this file is not part of any project.:

    this is wrong?

    Yes, it is. Resources are meant to be used to add data files to a project (and also QML code), but not C++ code. C++ code is compiled, not interpreted like QML.

  • @jsulm Yes, I see I'm taking a step back from here.
    Most (Beginner) Tutorials left me a bit overwhelmed after a while.
    I know some C++ and QT Core but just wanted to skip the Widgets and wanted to wrap my head around QML.
    Sadly there are not THAT many good resources out there when it comes to C++ classes in QtQuick. :/

Log in to reply