【发布时间】:2012-04-02 22:18:10
【问题描述】:
我正在 Ubuntu 11.04 上使用 NetBeans 6.9 开发 C++ 应用程序。我正在使用 OpenCV 2.3.1。我想知道是否有人可以告诉我这段代码有什么问题。
void AddTriangle(CvPoint buf[3], set< Triangle > &V)
{
Triangle triangle;
int inc;
for (inc=0; inc<3; ++inc)
{
triangle.v[inc].x=buf[inc].x;
triangle.v[inc].y=buf[inc].y;
}
V.insert((const Triangle) triangle);
}
我在尝试编译时收到以下错误消息。
from /usr/include/c++/4.5/bits/locale_classes.h:42,
from /usr/include/c++/4.5/bits/ios_base.h:43,
from /usr/include/c++/4.5/ios:43,
from /usr/include/c++/4.5/istream:40,
from /usr/include/c++/4.5/sstream:39,
from /usr/include/c++/4.5/complex:47,
from /usr/local/include/opencv2/core/core.hpp:59,
from ../../OpenCV-2.3.1/include/opencv/cv.h:64,
from ../../OpenCV-2.3.1/include/opencv/cv.hpp:50,
from ../../DraculaFiles/TwoDTriangulation.cpp:12:
/usr/include/c++/4.5/bits/stl_function.h: In member function ‘bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = sTriangle]’:
In file included from /usr/include/c++/4.5/string:50:0,
/usr/include/c++/4.5/bits/stl_tree.h:1184:4: instantiated from ‘std::pair, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(const _Val&) [with _Key = sTriangle, _Val = sTriangle, _KeyOfValue = std::_Identity, _Compare = std::less, _Alloc = std::allocator]’
/usr/include/c++/4.5/bits/stl_set.h:408:29: instantiated from ‘std::pair, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(const value_type&) [with _Key = sTriangle, _Compare = std::less, _Alloc = std::allocator, typename std::_Rb_tree<_Key, _Key, std::_Identity<_Key>, _Compare, typename _Alloc::rebind<_Key>::other>::const_iterator = std::_Rb_tree_const_iterator, value_type = sTriangle]’
三角形定义如下。
typedef struct sTriangle
{
CvPoint v[3];
} 三角形;
任何帮助将不胜感激,
彼得。
【问题讨论】:
-
我有一种感觉,不是完整的错误输出。应该有一行包含
error这个词。 -
当您检索错误输出的其余部分时,是否有理由不通过 for(int inc = 0; ...) 在本地确定循环计数器的范围?
-
错误信息的其余部分是
-
错误信息的其余部分是:/usr/include/c++/4.5/bits/stl_function.h:230:22: error: no match for 'operator
标签: c++ list opencv netbeans-6.9 ubuntu-11.04