65 lines · plain
1================================2Frequently Asked Questions (FAQ)3================================4 5.. contents::6 :local:7 8Driver9======10 11I run ``clang -cc1 ...`` and get weird errors about missing headers12-------------------------------------------------------------------13 14Given this source file:15 16.. code-block:: c17 18 #include <stdio.h>19 20 int main() {21 printf("Hello world\n");22 }23 24 25If you run:26 27.. code-block:: console28 29 $ clang -cc1 hello.c30 hello.c:1:10: fatal error: 'stdio.h' file not found31 #include <stdio.h>32 ^33 1 error generated.34 35``clang -cc1`` is the frontend, ``clang`` is the :doc:`driver36<DriverInternals>`. The driver invokes the frontend with options appropriate37for your system. To see these options, run:38 39.. code-block:: console40 41 $ clang -### -c hello.c42 43Some clang command line options are driver-only options, some are frontend-only44options. Frontend-only options are intended to be used only by clang developers.45Users should not run ``clang -cc1`` directly, because ``-cc1`` options are not46guaranteed to be stable.47 48If you want to use a frontend-only option ("a ``-cc1`` option"), for example49``-ast-dump``, then you need to take the ``clang -cc1`` line generated by the50driver and add the option you need. Alternatively, you can run51``clang -Xclang <option> ...`` to force the driver pass ``<option>`` to52``clang -cc1``.53 54I get errors about some headers being missing (``stddef.h``, ``stdarg.h``)55--------------------------------------------------------------------------56 57Some header files (``stddef.h``, ``stdarg.h``, and others) are shipped with58Clang --- these are called builtin includes. Clang searches for them in a59directory relative to the location of the ``clang`` binary. If you moved the60``clang`` binary, you need to move the builtin headers, too.61 62More information can be found in the :ref:`libtooling_builtin_includes`63section.64 65