diff --git a/docs/en/migration-guides/release-5.x/5.2/gcc.rst b/docs/en/migration-guides/release-5.x/5.2/gcc.rst index c608e2ff31..ef68aaa770 100644 --- a/docs/en/migration-guides/release-5.x/5.2/gcc.rst +++ b/docs/en/migration-guides/release-5.x/5.2/gcc.rst @@ -15,20 +15,20 @@ The previous GCC version was GCC 12.2.0. This has now been upgraded to GCC 13.2. Common Porting Problems and Fixes ================================= -stdio.h No Longer Includes sys/types.h --------------------------------------- +``stdio.h`` No Longer Includes ``sys/types.h`` +------------------------------------------------- -Issue: +Issue ^^^^^^ -Compile errors may occur in code that previously worked with the old toolchain. For example: +Compilation errors may occur in code that previously worked with the old toolchain. For example: .. code-block:: c #include clock_t var; // error: expected specifier-qualifier-list before 'clock_t' -Solution: +Solution ^^^^^^^^^ To resolve this issue, the correct header must be included. Refactor the code like this: diff --git a/docs/zh_CN/migration-guides/release-5.x/5.2/gcc.rst b/docs/zh_CN/migration-guides/release-5.x/5.2/gcc.rst index 5535b9fd91..daea31e902 100644 --- a/docs/zh_CN/migration-guides/release-5.x/5.2/gcc.rst +++ b/docs/zh_CN/migration-guides/release-5.x/5.2/gcc.rst @@ -10,3 +10,30 @@ GCC 版本 ESP-IDF 之前使用的 GCC 版本为 12.2.0,现已针对所有芯片目标升级至 GCC 13.2.0。若需要将代码从 GCC 12.2.0 迁移到 GCC 13.2.0,请参考以下 GCC 官方迁移指南。 * `迁移至 GCC 13 `_ + + +常见迁移问题和解决方法 +================================= + +``stdio.h`` 不再包含 ``sys/types.h`` +------------------------------------------------- + +问题描述 +^^^^^^^^^^^^ + +使用旧工具链的代码可能会出现编译错误,例如: + +.. code-block:: c + + #include + clock_t var; // error: expected specifier-qualifier-list before 'clock_t' + +解决方法 +^^^^^^^^^^^^ + +使用正确的头文件可以解决这一问题。请按照以下方式重构代码: + +.. code-block:: c + + #include + clock_t var;