C2491错误的原因是 “roundf”: 不允许 dllimport 函数 的定义 fusibile D:\Programs\depth_map\fusibile-master\mathUtils.h
linux中 ** roundf 是自己定义该函数 ** , 在Windows平台下重新定义了系统已有的roundf函数,并且该函数可能被系统或库声明为__declspec(dllimport),导致定义冲突。
在Windows系统中,#include 头文件已经提供了roundf函数, 所以不用再重复定义
// 删除以下代码
#if defined(_WIN32)
static float roundf ( float val ) {
return floor ( val+0.5f );
};
#endif
//加上头文件 #include <cmath>
安装fusible: https://github.com/YoYo000/fusibile 中编译出现的错