您好!
我正在使用 ti_cgt_tiarmclang_2.1.2.LTS。
我有 C++代码:
#包含
模板
struct integrity_constant : std :: integrity_constant {};
但我收到一个错误:
错误:对"STD"的引用有歧义
我在这里错过了什么?
谢谢。
Eli
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
您好!
我正在使用 ti_cgt_tiarmclang_2.1.2.LTS。
我有 C++代码:
#包含
模板
struct integrity_constant : std :: integrity_constant {};
但我收到一个错误:
错误:对"STD"的引用有歧义
我在这里错过了什么?
谢谢。
Eli
如果使用 TI Clang v2.1.3.LTS 并将代码粘贴到空源文件中、则不能重复该错误。
基于搜索(引用'是模糊的 和 编译器错误 C2872)您的"错误:引用'是模糊的"错误可能是由 在源代码或包含文件中使用命名空间 std 引起的。
您可以尝试从以下位置更改:
struct integral_constant : std::integral_constant<T, VALUE> {};
至:
struct integral_constant : ::std::integral_constant<T, VALUE> {};
其中,在 std 前面的前导: :使用来自全局命名空间的:: std : integrity_constant。
为什么有很多标准? [/报价]是否为"错误:对'STD'的引用有歧义"完整错误消息、或者编译器是否报告了更多诊断信息?
例如、我取示例代码从 引用到函数在 C++中有歧义 、而 TI Clang v2.1.3.LTS 报告的完整错误为:
Building file: "../test.cpp" Invoking: Arm Compiler "/home/mr_halfword/ti/ccs1230/ccs/tools/compiler/ti-cgt-armllvm_2.1.3.LTS/bin/tiarmclang" -c -march=armv7r -mcpu=cortex-r5 -mbig-endian -Og -I"/home/mr_halfword/workspace_v12/AM2634_CPP" -I"/home/mr_halfword/ti/ccs1230/ccs/tools/compiler/ti-cgt-armllvm_2.1.3.LTS/include" -g -MMD -MP -MF"test.d_raw" -MT"test.o" -o"test.o" "../test.cpp" subdir_rules.mk:14: recipe for target 'test.o' failed ../test.cpp:19:5: error: reference to 'greater' is ambiguous greater(a,b,c); ^ ../test.cpp:10:6: note: candidate found by name lookup is 'greater' void greater(int num1, int num2, int num3); ^ /home/mr_halfword/ti/ccs1230/ccs/tools/compiler/ti-cgt-armllvm_2.1.3.LTS/include/c++/v1/__functional/operations.h:584:29: note: candidate found by name lookup is 'std::greater' struct _LIBCPP_TEMPLATE_VIS greater ^ 1 error generated. gmake: *** [test.o] Error 1 gmake: Target 'all' not remade because of errors.即、对于上述示例、TI Clang 确定了模糊性的来源。