> ## Documentation Index
> Fetch the complete documentation index at: https://flox.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# C/C++

> Common questions and solutions for using C with Flox

## Build with Flox

Not only can you *develop* your software with Flox, but you can *build* it as well.
See the [builds](/concepts/builds) concept page for more details.

### Manifest builds

#### Autotools

Since `autotools` isn't specific to C, this example will also work for any project using `autotools`.
Since the output of the build must be copied to the `$out` directory, you must set the install prefix to `$out`.

```toml theme={null}
[build.myproject]
command = '''
  ./configure --prefix=$out
  make
  make install
'''
```

#### CMake

Doing a `CMake` build looks much the same as `autotools`.

```toml theme={null}
[build.myproject]
command = '''
  cmake -DCMAKE_INSTALL_PREFIX=$out
  make
  make install PREFIX=$out
'''
```

### Nix expression builds

To build a project using `clang`:

```nix theme={null}
{ clangStdenv }:

clangStdenv.mkDerivation {
  pname = "myproject";
  version = "0.0.1";
  src = ../../.;

  installFlags = [ "PREFIX=$(out)" ];
}
```
