在Visual Studio中重建我的项目时,我会在同一行错误C2371上遇到2个错误
While rebulding my project in visual studio, I am getting 2 errors on the same line error C2371
1. ERROR C2556:'ULONG HTONF(float)':超载功能仅通过返回类型从'unsigned int htonf(float)' (src audiorecorder.cpp)
2.错误C2371:'htonf':重新定义;不同的基本类型(src audiorecorder.cpp)
ulong htonf(float d)
{
#ifndef __BIG_ENDIAN__
ulong a;
uchar *dst = (uchar *)&a;
uchar *src = (uchar *)&d;
dst[0] = src[3];
dst[1] = src[2];
dst[2] = src[1];
dst[3] = src[0];
return a;
#else /* really no conversion necessary, but compiler warnings => optimazation requried todo */
ulong a;
uchar *dst = (uchar *)&a;
uchar *src = (uchar *)&d;
dst[0] = src[0];
dst[1] = src[1];
dst[2] = src[2];
dst[3] = src[3];
return a;
#endif
}
这是函数htonf
任何人都可以帮我吗?
您的ulong htonf(float d)
与Microsofts发生冲突。每个重载函数必须具有不同的不同参数列表。
unsigned __int32 __inline htonf( float value)
https://msdn.microsoft.com/en-us/library/windows/desktop/jj710198(v = vs.85).aspx
class C {
int func();
double func(); // <----- error C2556
int func(int i); // ok parameter lists differ
};
相关文章:
- 多个文件的内存分配错误"在抛出 'std :: bad_alloc' what (): std :: bad_alloc 的实例后终止调用" [C++]
- 使用命名空间时出现多个定义错误
- 如何确保在使用基于布尔值的两个方法之一调用方法时避免分支预测错误
- 当我在第一个循环中使用"auto"时,它工作正常,但是使用"int"它会给出错误,为什么?
- 使用OpenCV和覆盆子上的多个网络摄像头拍摄延时摄影,出现多个V4L错误
- 使用 make 编译 MPI,几个命名空间错误,例如"错误:未知类型名称'使用'?
- C++ 中的编译错误:未定义对"主"的引用 collect2:错误:ld 返回 1 个退出状态
- OpenGL 4.3 错误地将第 4 个纹理坐标映射到与第 3 个纹理坐标相同的位置
- 键盘不起作用 - Arduino Uno - 与变量有关的多个错误
- 编译问题:在函数"_start"中:未定义对"主"的引用 collect2:错误:ld 返回 1 个退出状态
- 使用 g++ 编译时出现多个错误?
- 即使我没有包含多个文件,C++中的多个定义错误
- 2个模板化类的非模板友元函数未定义引用错误
- MSVC 错误:4 个重载中的任何一个都无法转换所有参数类型
- 输出错误:两个不同编译器上的不同输出:Prime Cryptarithm USACO
- 错误:多个文件中的结构声明冲突
- 链接器不指出错误;多个定义警告指向同一行
- 生成错误:12 个重载中没有一个可以转换所有参数类型
- visual C++LNK1120致命错误:1个未解析的外部
- 程序特定的OpenGL运行时错误:多个输入缓冲区蒙皮动画