混淆函数名称
Mingw confusing function names
本文关键字:函数 更新时间:2023-10-16
我目前正在将一些代码从Visual Studio移植到Mingw。编写组件的人不再可用,我不太熟悉组件的细节。目前我遇到了一个问题,我发现 Mingw 将函数的名称与内部函数混淆了。代码是这样的
void _mm_prefetch(char const *_A, int _Sel);
static FORCE_INLINE void sysdep_intrin_prefetch(void *ptr, cardinal_t offset)
{
_mm_prefetch(REINTERPRET_CAST(const char *, cardinal_to_ptr(ptr_to_cardinal(ptr) + offset)),
1 /* _MM_HINT_T0 */);
}
错误如下:
||=== Build: Debug x64 in AVS_Wrapper (compiler: MinGW GCC - 2/17/2015) ===|
avs2includewin32aiw.h|247|error: variable or field '__builtin_prefetch' declared void|
avs2includewin32aiw.h|247|error: expected primary-expression before 'char'|
avs2includewin32aiw.h|247|error: expected ')' before 'char'|
avs2includewin32aaw64.h|13|error: expected unqualified-id before '__asm__'|
||=== Build failed: 4 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
这是我的构建窗口
g++.exe -std=c++11 -DWIN32 -D_DEBUG -D_WINDOWS -D_USRDLL -DAVS_WRAPPER_EXPORTS -DAVS_TARGET_WIN7 -std=c++11 -Iavs2includewin32 -I........mingw64requiredboost_1_57_0 -I. -IC:Usersadmingc3avw -c C:Usersadmingc3avwavw.cpp -o "Win32Debug x64avw.o"
g++.exe -std=c++11 -DWIN32 -D_DEBUG -D_WINDOWS -D_USRDLL -DAVS_WRAPPER_EXPORTS -DAVS_TARGET_WIN7 -std=c++11 -Iavs2includewin32 -I........mingw64requiredboost_1_57_0 -I. -IC:Usersadmingc3avwwrapper -c C:Usersadmingc3avwwrapperAvsSystem.cpp -o "Win32Debug x64wrapperAvsSystem.o"
In file included from C:/mingw64/lib/gcc/x86_64-w64-mingw32/4.8.2/include/x86intrin.h:34:0,
from C:/mingw64/x86_64-w64-mingw32/include/winnt.h:1495,
from C:/mingw64/x86_64-w64-mingw32/include/minwindef.h:147,
from C:/mingw64/x86_64-w64-mingw32/include/windef.h:8,
from C:/mingw64/x86_64-w64-mingw32/include/windows.h:69,
from C:Usersadmingc3avwwrapperAvsSystem.cpp:1:
avs2includewin32/aiw.h:247:6: error: variable or field '__builtin_prefetch' declared void
void _mm_prefetch(char const *_A, int _Sel);
显然,从我目前的理解来看,编译器认为 _mm_prefetch
功能__builtin_prefetch
我如何告诉编译器它们是不同的。我有什么选择来规避这个问题?
Mingw 将函数的名称与内部函数混淆
了
它100%有权这样做。 语言规则(2.10p3)规定:
每个以下划线开头的标识符都保留给实现,以用作全局命名空间中的名称。
不要将自己的函数命名为 _mm_prefetch
。 (也就是说,要修复错误,您必须重命名函数。
相关文章:
- "error: no matching function for call to"构造函数错误
- 什么时候调用组成单元对象的析构函数
- 继承函数的重载解析
- 为什么随机数生成器不在void函数中随机化数字,而在main函数中随机化
- C++模板来检查友元函数的存在
- 递归函数计算序列中的平方和(并输出过程)
- 对RValue对象调用的LValue ref限定成员函数
- C++17复制构造函数,在std::unordereded_map上进行深度复制
- 将数组作为参数传递给函数安全吗?作为第三方职能部门,可以探索他们想要的之外的其他元素
- 在C++STL中是否有Polyval(Matlab函数)等价物?
- 为什么使用 "this" 指针调用派生成员函数?
- 将对象数组的引用传递给函数
- 函数调用中参数的顺序重要吗
- 函数向量_指针有不同的原型,我可以构建一个吗
- 使用不带参数的函数访问结构元素
- 代码在main()中运行,但在函数中出现错误
- 内置函数可查看CPP中的成员变量
- 如何获取std::result_of函数的返回类型
- 如何在c++中为模板函数实例创建快捷方式
- 如果C++类在类方法中具有动态分配,但没有构造函数/析构函数或任何非静态成员,那么它仍然是POD类型吗