newby - 错误:在此范围内未声明'rint' [英] newby - error: 'rint' was not declared in this scope

查看:91
本文介绍了newby - 错误:在此范围内未声明'rint'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试编译一个实用程序来创建.avi文件。参见
http://cpbotha.net/im2avi

我正在研究Debian etch(混合测试/不稳定)。


dweber @ dnlweber:〜/ im2avi-0.4 $ g ++ --version

g ++(GCC)4.0.4 20060507(预发布)(Debian 4.0.3-3)

版权所有(C)2006 Free Software Foundation,Inc。

是免费软件;查看复制条件的来源。有

NO

保修;甚至不适用于适销性或特定适用性

目的。

当我尝试编译时,我收到了很多范围错误。我已经通过使用std ::来修复

。但是,我不知道这个问题的解决方法:


im2avi_t.cxx:在会员功能''无效

im2avi_t :: update_image_width(bool)'':

im2avi_t.cxx:338:错误:''rint''未在此范围内声明


名为im2avi_t.cxx的程序源包括:


#include< math.h //我假设我们得到了rint()


出现此错误的代码部分包括:


void im2avi_t :: update_image_width(bool ignore_aspect)

{

//更新类变量

image_width =(int)main_window-> im_width_input-> value();

//更新模数ui元素

main_window-> wm4_output-> value(image_width%4);

main_window-> wm8_output-> value(image_width%8);

main_window-> wm16_output-> value(image_width%16);

//如果允许则更新高度

if(!ignore_aspect&& main_window-> constrain_aspect_check-> value())

{

main_window-> im_height_input-> value(rint(image_width /

image_aspect_ratio));

update_image_height(true);

}

//如果用户告诉我们,我们只更新图像宽高比没有

来限制它,但是程序员没有告诉我们忽略它,否则我们会在宽度

改变时得到奇怪的交互如果(!main_window-> constrain_aspect_check-> value()&& !ignore_aspect

&& image_width 0&& image_height 0)

{

update_image_aspect_ratio((float)image_width /(float)

image_height);

}

}

如何修复与rint相关的错误()


先谢谢,Darren


I am trying to compile a utility to create .avi files. See
http://cpbotha.net/im2avi
I''m working on Debian etch (a mix of testing/unstable).

dweber@dnlweber:~/im2avi-0.4$ g++ --version
g++ (GCC) 4.0.4 20060507 (prerelease) (Debian 4.0.3-3)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
When I try to compile, I am getting a lot of scope errors. I''ve fixed
a lot of them by just using std:: where it is missing. However, I
don''t know a fix for this one:

im2avi_t.cxx: In member function ''void
im2avi_t::update_image_width(bool)'':
im2avi_t.cxx:338: error: ''rint'' was not declared in this scope

The program source named im2avi_t.cxx includes, among others:

#include <math.h // where I assume we get rint()

The section of code, among others, that has this error is:

void im2avi_t::update_image_width(bool ignore_aspect)
{
// update class variable
image_width = (int)main_window->im_width_input->value();
// update modulus ui elements
main_window->wm4_output->value(image_width % 4);
main_window->wm8_output->value(image_width % 8);
main_window->wm16_output->value(image_width % 16);
// update height if allowed
if (!ignore_aspect && main_window->constrain_aspect_check->value())
{
main_window->im_height_input->value(rint(image_width /
image_aspect_ratio));
update_image_height(true);
}
// we only update the image aspect ratio if the user has told us NOT
to constrain it, but the programmer has NOT
// told us to ignore it, else we get strange interaction when width
changes affect height and vice versa
if (!main_window->constrain_aspect_check->value() && !ignore_aspect
&& image_width 0 && image_height 0)
{
update_image_aspect_ratio((float) image_width / (float)
image_height);
}
}
How do I fix this error related to rint()

Thanks in advance, Darren

推荐答案

g ++ --version

g ++(GCC)4.0.4 20060507(预发布)(Debian 4.0.3-3 )

版权所有(C)2006 Free Software Foundation,Inc。

这是免费软件;查看复制条件的来源。有

NO

保修;甚至不适用于适销性或特定适用性

目的。

当我尝试编译时,我收到了很多范围错误。我已经通过使用std ::来修复

。但是,我不知道这个问题的解决方法:


im2avi_t.cxx:在会员功能''无效

im2avi_t :: update_image_width(bool)'':

im2avi_t.cxx:338:错误:''rint''未在此范围内声明


名为im2avi_t.cxx的程序源包括:


#include< math.h //我假设我们得到了rint()


出现此错误的代码部分包括:


void im2avi_t :: update_image_width(bool ignore_aspect)

{

//更新类变量

image_width =(int)main_window-> im_width_input-> value();

//更新模数ui元素

main_window-> wm4_output-> value(image_width%4);

main_window-> wm8_output-> value(image_width%8);

main_window-> wm16_output-> value(image_width%16);

//如果允许则更新高度

if(!ignore_aspect&& main_window-> constrain_aspect_check-> value())

{

main_window-> im_height_input-> value(rint(image_width /

image_aspect_ratio));

update_image_height(true);

}

//如果用户告诉我们,我们只更新图像宽高比没有

来限制它,但是程序员没有告诉我们忽略它,否则我们会在宽度

改变时得到奇怪的交互如果(!main_window-> constrain_aspect_check-> value()&& !ignore_aspect

&& image_width 0&& image_height 0)

{

update_image_aspect_ratio((float)image_width /(float)

image_height);

}

}

如何修复与rint相关的错误()


先谢谢,Darren

g++ --version
g++ (GCC) 4.0.4 20060507 (prerelease) (Debian 4.0.3-3)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
When I try to compile, I am getting a lot of scope errors. I''ve fixed
a lot of them by just using std:: where it is missing. However, I
don''t know a fix for this one:

im2avi_t.cxx: In member function ''void
im2avi_t::update_image_width(bool)'':
im2avi_t.cxx:338: error: ''rint'' was not declared in this scope

The program source named im2avi_t.cxx includes, among others:

#include <math.h // where I assume we get rint()

The section of code, among others, that has this error is:

void im2avi_t::update_image_width(bool ignore_aspect)
{
// update class variable
image_width = (int)main_window->im_width_input->value();
// update modulus ui elements
main_window->wm4_output->value(image_width % 4);
main_window->wm8_output->value(image_width % 8);
main_window->wm16_output->value(image_width % 16);
// update height if allowed
if (!ignore_aspect && main_window->constrain_aspect_check->value())
{
main_window->im_height_input->value(rint(image_width /
image_aspect_ratio));
update_image_height(true);
}
// we only update the image aspect ratio if the user has told us NOT
to constrain it, but the programmer has NOT
// told us to ignore it, else we get strange interaction when width
changes affect height and vice versa
if (!main_window->constrain_aspect_check->value() && !ignore_aspect
&& image_width 0 && image_height 0)
{
update_image_aspect_ratio((float) image_width / (float)
image_height);
}
}
How do I fix this error related to rint()

Thanks in advance, Darren




Darren L. Weber写道:

Darren L. Weber wrote:

我正在尝试编译一个用于创建.avi文件的实用程序。参见
http://cpbotha.net/im2avi

我正在研究Debian etch(混合测试/不稳定)。


dweber @ dnlweber:〜/ im2avi-0.4
I am trying to compile a utility to create .avi files. See
http://cpbotha.net/im2avi
I''m working on Debian etch (a mix of testing/unstable).

dweber@dnlweber:~/im2avi-0.4


g ++ --version

g ++(GCC)4.0.4 20060507(预发布)(Debian 4.0.3-3)

版权所有(C)2006 Free Software Foundation,Inc 。

这是免费软件;查看复制条件的来源。有

NO

保修;甚至不适用于适销性或特定适用性

目的。


当我尝试编译时,我收到了很多范围错误。我已经通过使用std ::来修复

。但是,我不知道这个问题的解决方法:


im2avi_t.cxx:在会员功能''无效

im2avi_t :: update_image_width(bool)'':

im2avi_t.cxx:338:错误:''rint''未在此范围内声明


名为im2avi_t.cxx的程序源包括:


#include< math.h //我假设我们得到rint()
g++ --version
g++ (GCC) 4.0.4 20060507 (prerelease) (Debian 4.0.3-3)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is
NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
When I try to compile, I am getting a lot of scope errors. I''ve fixed
a lot of them by just using std:: where it is missing. However, I
don''t know a fix for this one:

im2avi_t.cxx: In member function ''void
im2avi_t::update_image_width(bool)'':
im2avi_t.cxx:338: error: ''rint'' was not declared in this scope

The program source named im2avi_t.cxx includes, among others:

#include <math.h // where I assume we get rint()



< snip>

< snip >


如何修复与rint相关的错误()
How do I fix this error related to rint()



你试过吗?

#include< cmath>



std :: rint()


??


did you try :
#include <cmath>
and
std::rint()

??


这篇关于newby - 错误:在此范围内未声明'rint'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆