Nominate our 2022 Qt Champions!

Is there a workaround for this ?

  • In QT Creator, When you go to : File-->New File or Project --> NON-QT Projects --> Plain C Application --> Choose-->Enter a Name for Project-->Next-->Next-->Finish

    (1)the default file created is main.c and it contains :

    #include <stdio.h>

    int main(int argc, char *argv[])
    printf("Hello World!\n");
    return 0;

    I want main.c to be empty.
    is there a way to make main.c empty when we open a plain C application project ?

    (2) Why is it that there are no items in Class View when I choose "class view" from the drop down list at the top left corner ?(when you create a plain C++ project with the default main.cpp in it and a few other classes thrown in )

  • Moderators

    Hi, welcome to the forum.

    1. You can go to the <Qt Creator install dir>/share/qtcreator/templates/wizards/projects/plainc directory and edit the main.c template file to be whatever you want.

    2. It works for me. Which build system/compiler/OS do you use?

  • Thanks for answering number (1).

    Regarding number (2), I choose Cmake as my build system...would that be a probable cause ? I also cant add any files to my project under the "Projects" Drop Down list

  • Windows 7 64 bit , Cmake , QTC 4.0.1, QT 5.6.1

    planning to install QTC on Ubuntu MaTE 64-bit with GCC/G++

  • Moderators

    AFAIK CMake integration is getting better but is still a work in progress. Some stuff works, some doesn't. See the docs for an overview what's already implemented. If I'm not mistaken adding files is done by editing the CMakeLists.txt.

Log in to reply