锐英源软件
第一信赖

精通

英语

开源

擅长

开发

培训

胸怀四海 

第一信赖

当前位置:锐英源 / 英语翻译 / 鼠标手势识别 / VC++不同版本对数学函数参数调用的影响和解决办法
服务方向
人工智能数据处理
人工智能培训
kaldi数据准备
小语种语音识别
语音识别标注
语音识别系统
语音识别转文字
kaldi开发技术服务
软件开发
运动控制卡上位机
机械加工软件
软件开发培训
Java 安卓移动开发
VC++
C#软件
汇编和破解
驱动开发
联系方式
固话:0371-63888850
手机:138-0381-0136
Q Q:396806883
微信:ryysoft

锐英源精品开源心得,转载请注明:“锐英源www.wisestudy.cn,孙老师作品,电话13803810136。需要全文内容也请联系孙老师。

VC++不同版本对数学函数参数调用的影响和解决办法

i wasn't sure how well this would work but i tried it out and it's just darn neat. But it's now many years since this was posted and newer versions of Microsoft C++ won't compile this for all sorts of reasons. Here's what i remember changing to get it to work

我不确定以后会怎么样,但我试过,只是整洁问题。但是因为许多年以来发布的微软c++更新的版本不会编译等等各种原因。这就是我记得让它工作的改变。

Numerous errors due to pow. All arguments must be typecast to floating point It's used to do calculate the distance between the current and last point (using the Pythagorean theorem). Pow was being a pain so in the end, i wrote my own distance function:

无数的错误都因为表达式。所有参数都必须被强制转换为浮点用来做计算当前和最后一个点之间(利用勾股定理)的距离。表达式因为在在最后,我写了自己的距离函数:

double Board::getStraightLineDistance(POINT start, POINT end) 
          {
          //--- Calculate how far the point has moved
          //--- Distance = straight line (Euclidean) distance
          long changeInX = start.x - end.x;
          long changeInY = start.y - end.y;
          //--- Good old Pythagorean theorem: a^2 + b^2 = c^2
          double distance = sqrt((double)(changeInX*changeInX) + (double)(changeInY*changeInY));
          return distance;
          }   

Call it (in TransformPath) like: 调用它(变换路径),如:

d = getStraightLineDistance(*p, *i);

Note that i renamed a lot of the variables, so technically my code says distance=, not d=.

请注意,我重命名了很多的变量,所以在技术上我的代码表示距离=,而不是D =。

sqrt also complains for the same reason as pow. You have to explicitly convert all the parameters to a floating point number. Here's an example:

sqrt函数被抱怨了,因为它和pow函数有一样的问题。你必须将所有的参数转换为一个浮点数。这里有一个例子:

m_cosines[n] = float(pt2.y / sqrt((double)(pt2.x * pt2.x) + (double)(pt2.y * pt2.y)));
    m_sinuses[n] = (float)sqrt(1. - (double)(m_cosines[n] * m_cosines[n]));      

Not sure how this ever compiled: 不知道这是否编译过:

  static vector_to_path(RECT& rc, vector_real_t& vec, path_t& path);

It has no return type. Even though it doesn't return anything, C++ (although not C) requires a return type. So i changed it to this: 它没有返回类型。尽管它不返回任何值,c++(尽管不是C)需要一个返回类型。所以我把它调整为:

static void vector_to_path(RECT& rc, vector_real_t& vec, path_t& path);

i think every change i made was in Board with a single exception. SelectionSliderCtrl's definition is wrong. The first template parameter (type) needs to be written in it's own template fashion. Here's the right way to write it:

我认为我做的每一个变化在画板上都有一个例外。SelectionSliderCtrl的定义是错误的。第一个模板参数(类型)需要用它自己的模板的方式来写。这是正确的写法:

template <typename T>
    class SelectionSliderCtrlT : 
    public CWindowImpl<SelectionSliderCtrlT<T>, T>

i think that's everything it took to get this to compile under VS2005. i don't think 2008 requires any additional changes but i haven't tested it yet

我认为所有的都要在VS2005编译。我不认为2008年要求任何额外的修改,但我还没有测试过。

友情链接
版权所有 Copyright(c)2004-2021 锐英源软件
公司注册号:410105000449586 豫ICP备08007559号 最佳分辨率 1024*768
地址:郑州大学北校区院(文化路97号院)内