Qt Creator can't find include headers



  • I just opened a .C file without creating a project and Qt Creator says "stdio.h: No such file or directory" for

    #include <stdio.h>
    

    If I create a project there is no problem but when I want to just edit a .C file, program can't find the headers.

    I'm using Xubuntu 15.10 and Qt 5.7.0 GCC 64Bit kit.


  • Moderators

    @maydin

    How did you open a file and when are you getting the error message?

    You are required to include a .C file into a project for running the compiler. Therefore, without opening and including or creating a project you cannot compile.

    If I understand you correctly, every thing is fine since you can compile without error message when including the .C file into a project.

    Qt creator is just an IDE. It allows editing and starting processes like compiling and linking. In order to achieve this it is required to use some other tools (e.g. compiler), but also some Qt tools such as qmake. qmake requires a proper .pro file and will create a make file, which supports the compilation. Anything missing the chain will result in a failure.



  • In file manager I just did "Open file with 'Qt Creator'". It is just a simple C file. I don't want to compile it via Qt Creator. I just want to edit my code. Because of this problem, I can't use code hinting etc. I will compile it using gcc in terminal later.

    As you can see this doesn't belong to a project, therefore there is no .pro file.
    alt text


  • Moderators

    @maydin

    AFAIK the include path definition is missing. Without project creator does not know how you plan to compile it later on. Therefore, some of the hinting is missing.

    The background is that Qt creator is an IDE where you can easily change between different tool chains. E.g. you can use an old compiler version and do the compilation and at next you may use a newer compiler version and compile the same code. Not sure what an alternative for gcc would be on linux, but on windows, you can use with one compile run MinGW (gcc derivate) and with some clicks you change everything and do a compile with the microsoft compiler.

    All this is defined through so-called kits. Changing a kit to another do also change the hinting and stuff. However, you have no kit defined therefore creator does not know how and what to "hint".

    Certainly you can use creator as pure editor, but that provides some hick-ups with reduced support (e.g. hinting).

    For your case you can add a project file for defining the requried and do the compilation from a terminal lateron. However, you miss out quite a lot of stuff helping you otherwise.


Log in to reply
 

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