blob: dc97507f054bc147a4c96023f171d282b01d7525 [file] [log] [blame]
Dmitri Gribenko1834a042013-01-06 13:38:34 +00001================================
2Frequently Asked Questions (FAQ)
3================================
4
5.. contents::
6 :local:
7
8Driver
9======
10
11I run ``clang -cc1 ...`` and get weird errors about missing headers
12-------------------------------------------------------------------
13
14Given this source file:
15
16.. code-block:: c
17
18 #include <stdio.h>
19
20 int main() {
21 printf("Hello world\n");
22 }
23
24
25If you run:
26
27.. code-block:: console
28
29 $ clang -cc1 hello.c
30 hello.c:1:10: fatal error: 'stdio.h' file not found
31 #include <stdio.h>
32 ^
33 1 error generated.
34
35``clang -cc1`` is the frontend, ``clang`` is the :doc:`driver
36<DriverInternals>`. The driver invokes the frontend with options appropriate
37for your system. To see these options, run:
38
39.. code-block:: console
40
41 $ clang -### -c hello.c
42
43Some clang command line options are driver-only options, some are frontend-only
44options. Frontend-only options are intended to be used only by developers.
45Users should not run ``clang -cc1`` directly.
46
47If you want to use a frontend-only option ("a ``-cc1`` option"), for example
48``-ast-dump``, then you need to take the ``clang -cc1`` line generated by the
49driver and add the option you need. Alternatively, you can run
50``clang -Xclang <option> ...`` to force the driver pass ``<option>`` to
51``clang -cc1``.
52