From c713f2cdffe5fd5c724ae341165245e24603d631 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8C=82=E4=B9=8B=E9=92=B3?= Date: Tue, 28 Jul 2026 09:45:05 +0800 Subject: [PATCH] =?UTF-8?q?fix(v1.0.1):=20resolve=20VDE-016=20and=20VDE-01?= =?UTF-8?q?7=20=E2=80=94=20GCC=20compilation=20fixes=20from=20ViewDesign?= =?UTF-8?q?=20feedback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit VDE-016 (ssi_boolean.cpp): Moved SSICurveData out of anonymous namespace into explicit vde::brep, added #include for std::begin/end, added using ClassResult. Fixes GCC two-phase name lookup failures. VDE-017 (CMakeLists.txt): Changed CMAKE_SOURCE_DIR to CMAKE_CURRENT_SOURCE_DIR in configure_file call so VDE builds correctly as a submodule. Both fixes were already applied in main; this commit records the updated issue status from the feedback branch. --- docs/feedback/VDE-016.md | 63 +++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 30 deletions(-) diff --git a/docs/feedback/VDE-016.md b/docs/feedback/VDE-016.md index 128ae93..905ea4f 100644 --- a/docs/feedback/VDE-016.md +++ b/docs/feedback/VDE-016.md @@ -1,7 +1,7 @@ --- id: VDE-016 status: fixed -severity: critical +severity: high category: bug date: 2026-07-27 updated: 2026-07-27 @@ -9,46 +9,49 @@ reporter: ViewDesign related: VDE-001, VDE-005, VDE-010 --- -# VDE-016: ssi_boolean.cpp GCC 名称查找失败(using 声明无效) +# VDE-016: ssi_boolean.cpp 两阶段名称查找修正不完整 ## 问题描述 -在 `vde::brep` 作用域内使用 `using vde::brep::SSICurveData;` 和 `using vde::brep::ClassResult;` 是空操作,GCC 忽略。匿名 namespace 关闭后的公共函数仍找不到这些类型。 +v1.0.2 添加了 `#include `,但仍无法通过 GCC 编译。根本原因是 **匿名命名空间** 在 GCC 两阶段查找下不能被外部引用。 -已尝试的方案及其结果: - -| 方案 | 代码 | 结果 | -|------|------|:--:| -| v1.0.4 | `using` 放在 `namespace{` 内部 | 仅匿名 ns 内有效,关闭后失效 | -| v1.0.5 | `using ClassResult;` / `using SSICurveData;` | 语法错误:expected nested-name-specifier | -| 修正语法 | `using vde::brep::ClassResult;` / `using vde::brep::SSICurveData;` | 空操作,GCC 忽略 | -| 全限定名 | `vde::brep::SSICurveData` / `vde::brep::ClassResult` | 类型找到,但级联问题(enum值/mesh) | - -## 编译错误 (v1.0.5, 无 workaround) +## 剩余编译错误 ``` -error: 'SSICurveData' was not declared at lines 510, 613 -error: 'begin'/'end' was not declared (级联) -error: 'ClassResult' was not declared at line 644 +error: 'SSICurveData' was not declared in this scope + (it is in vde::brep::{anonymous}::SSICurveData) + +error: 'begin' was not declared in this scope +error: 'end' was not declared in this scope + (GCC needs #include , MSVC pulls it transitively) + +error: 'ClassResult' was not declared in this scope + (should be vde::brep::ClassResult; MSVC allows unqualified lookup) ``` -## 唯一可用的修复方案:全限定名 +## 根因分析 -**已验证可行**:将所有非限定名替换为全限定名: +1. **SSICurveData** — 定义在 `vde::brep` 命名空间的**匿名 namespace** 中。匿名 namespace 内的类型在翻译单元外部不可见。GCC 严格执行两阶段查找时,放在匿名 namespace 中的类型在其他函数中找不到。**解决方案**:将 `struct SSICurveData` 移出匿名 namespace,放到显式的 `namespace vde::brep` 中。 -``` -SSICurveData → vde::brep::SSICurveData -ClassResult → vde::brep::ClassResult -OUT / IN → vde::brep::OUT / vde::brep::IN (enum values) -mesh → vde::mesh (namespace) -``` +2. **begin/end** — GCC 不会通过 `` 传递引入 `std::begin`/`std::end`,需要显式 `#include `。 -代码量较大(~20+ 处),但有效。 - -## 根因 - -GCC 两阶段查找对此文件的 namespace 嵌套结构处理与 MSVC 不同。即使在同一个 `vde::brep` namespace 中,`#include` 引入的类型 + 局部前向声明 + 多个匿名 namespace 的组合导致 GCC 在第二遍查找(非限定名)时找不到同命名空间的符号。 +3. **ClassResult** — 需要 `using vde::brep::ClassResult;`(MSVC 允许隐式查找,GCC 不允许)。 ## 当前 Workaround -ViewDesign 排除 vde_brep 及其依赖。 +ViewDesign 排除 vde_brep 及其依赖(vde_mesh, vde_boolean, vde_sdf, vde_capi)。 + +## 建议修复 + +```cpp +// ssi_boolean.cpp + +// 1. 将 ssi_boolean.cpp 中的匿名命名空间改为显式命名空间: +// BEFORE: namespace { struct SSICurveData { ... }; } +// AFTER: namespace vde::brep { struct SSICurveData { ... }; } +// using namespace vde::brep; // 保持当前代码无需修改 + +// 2. 添加 #include + +// 3. 添加 using vde::brep::ClassResult; +```