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

Can't remove files or create directories?



  • This must just be me being stupid, but if I create a new non-qt C++ project, I can't delete the remove the default main.cpp from the project! The option is greyed out on the right-click menu.

    I can add new files ok, but I want to organize them into subfolders (my project will have several targets and I want to keep it neat). How do I create a folder? There's a "create new subproject" option in the right-click menu, but that's greyed out. If I try adding a new file to the project I can use the file dialog to create a folder on the filesystem and put the file in that, but it's not shown in the tree view!

    What am I doing wrong? I'm on os x 10.7. I get the same results in creator 2.5 and 2.6


  • Moderators

    Short answer: you can't.

    Simplest way is most likely to just edit the .pro-file and to create the directory manually.

    Project view shows the structure of the project files. "Folders" there are not necessarily found in the filesystem. A subproject is just a .pro-file that gets referenced in its parent .pro-file.



  • Thanks Tobias! OK that makes sense, but any idea why the create subprojects or remove files?


  • Moderators

    Whether Creator can add/remove files depends a lot on the build system you use: We can do that on qmake, but for cmake and others that is basically impossible to do correctly. So maybe you are just using the "wrong" build system for those operations.

    I don't have enough information to provide a definitive answer, sorry.



  • Ah ok that makes sense - creator is using the CMakeLists.txt as a project file as well then? Is there any way of doing a hybrid setup? So I would use qmake .pro files as the project file but actually use cmake for building?


Log in to reply