The present document compiles a list of guidelines, recommendations, and
expectations around the topic of compiling C and C++ code against the Core SDK.

## Sysroot

The Fuchsia sysroot for a given target architecture is available under
`//arch/<architecture>/sysroot`.
That directory contains a complete sysroot and may be used with any tool that
accepts a `--sysroot` flag.

## Prebuilts

All prebuilts have C linkage.

### Debug symbols

Debug symbols for all prebuilts are available under `//.build-id`, which follows
a [standard convention](https://fedoraproject.org/wiki/Releases/FeatureBuildId#Find_files_by_build_ID).

## Compilation parameters

- C++ sources must be compatible with C++17, C++20, and C++23.

### Warning flags

The following flags are guaranteed to not generate any warning:
- `-Wall`
- `-Wctad-maybe-unsupported`
- `-Wextra-semi`
- `-Wnewline-eof`
- `-Wnon-virtual-dtor`
- `-Wshadow`

The following flags may generate warnings:
- `-Wdeprecated-declarations`
[](https://issues.fuchsia.dev/issues/new?component=1439230&template=1881640&description=Issue+on:+https://fuchsia.dev/docs/development/idk/documentation/compilation.md "Report a bug or suggest improvements on this page") [](https://cs.opensource.google/fuchsia/fuchsia/+/main:docs/development/idk/documentation/compilation.md "View the source code of this page") [](https://ci.android.com/edit?repo=fuchsia/fuchsia/main&file=docs/development/idk/documentation/compilation.md&cloneRepo=fuchsia/fuchsia:refs/heads/main&fullPath=fuchsia/docs/development/idk/documentation/compilation.md "Edit the source code of this page")