Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-19667

Clang Code Model fails to find header files (Generic Project)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • Qt Creator 4.5.0, Qt Creator 4.6.0-beta1
    • C/C++/Obj-C++ Support
    • Fedora 27, Clang v5.0.1, Qt Creator 4.6.0 Beta1-1871

    Description

      I'm running Clang v5.0.1, originally on Qt Creator 4.5.0, but it behaves the same on 4.6.0 Beta1-1871. A simple hello-world application:

      #include <iostream>
      
      int main(int, char*[])
      {
          std::cout << "Hello World" << std::endl;
          return EXIT_SUCCESS;
      }
      

       
      This obviously compiles and runs fine under GCC, but the CCM marks every line as some kind of error. Enabling CCM debug for Qt Creator reveals some interesting things: Clang cannot seem to find a header file despite looking in the correct place:

      ...
      #include "..." search starts here:
      #include <...> search starts here:
       /home/cmannett85/workspace/qtcreator-4.6.0-beta1/libexec/qtcreator/clang/lib/clang/5.0.1/include
       /home/cmannett85/workspace/qtcreator-4.6.0-beta1/share/qtcreator/cplusplus/wrappedQtHeaders
       /home/cmannett85/workspace/qtcreator-4.6.0-beta1/share/qtcreator/cplusplus/wrappedQtHeaders/QtCore
       /home/cmannett85/workspace/calrec/scratch
       /home/cmannett85/workspace/calrec
       /usr/local/include
       /usr/include
       /usr/include/c++/7
       /usr/include/c++/7/x86_64-redhat-linux
       /usr/include/c++/7/backward
       /usr/lib/gcc/x86_64-redhat-linux/7/include
       /tmp/QtCreator-mBdlxZ/clang-uiheader-UUGInf
      End of search list.
      Parsing /home/cmannett85/workspace/calrec/scratch/main.cpp:   0.1768 (100.0%)   0.0106 (100.0%)   0.1874 (100.0%)   0.1895 (100.0%)  
      /usr/include/c++/7/cstdlib:75:15: fatal error: 'stdlib.h' file not found
      ...
      

      stdlib.h is in /usr/include, but for some reason Clang just doesn't see it.  I've attached the complete clang debug output.

      Attachments

        1. ccm_output.txt
          17 kB
          camden
        2. clang_debug.txt
          64 kB
          camden
        3. image-2018-08-22-10-38-59-746.png
          263 kB
          Michael Smirnoff
        4. image-2018-08-22-10-44-10-267.png
          77 kB
          Michael Smirnoff
        5. image-2020-02-24-16-58-54-343.png
          106 kB
          Evgeny Evgenyev
        6. log_clang.txt
          73 kB
          thibaultlejemble

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              kandeler Christian Kandeler
              camden camden
              Votes:
              8 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes