# 错误：未找到 #include <foo.h>

- **ID:** `go/cgo-cflags-missing-include`
- **领域:** go
- **类别:** build_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

CGo预处理器找不到头文件，因为未指定包含路径。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.19 | active | — | — |
| 1.20 | active | — | — |

## 解决方案

1. **Add `// #cgo CFLAGS: -I/path/to/include`** (90% 成功率)
   ```
   // #cgo CFLAGS: -I/usr/local/include
// #include <foo.h>
import "C"
   ```
2. **Use `pkg-config` for automatic include paths** (85% 成功率)
   ```
   // #cgo pkg-config: foo
// #include <foo.h>
import "C"
   ```

## 无效尝试

- **Copying header to current directory** — Works but not scalable; may miss other headers. (30% 失败率)
- **Using `-I.` without relative path** — Only works if header in current dir. (50% 失败率)
