jjzjj

argument

全部标签

c++ - OpenCV 错误 : Sizes of input arguments do not match (The operation is neither 'array op array' )

我正在做一个在树莓派上使用opencv的项目。我遇到了一个看起来很简单的障碍,但我无法解决问题。首先,这是我的代码的一部分:{gray=cvarrToMat(py);///cvShowImage("camcvWin",py);//displayonlygraychannelif(img_num%2==1){cv::imwrite("/home/pi/test/Gray_2Image1.jpg",gray);}elseif(img_num%2==0){cv::imwrite("/home/pi/test/Gray_2Image2.jpg",gray);cv::Matimg2=cv::im

c++ - Eigen 与 -O3 警告 : argument 1 value ‘X’ exceeds maximum object size Y

发生了什么当我按照教程onEigenwebsite尝试将Eigen::Vector3f添加到std::vector中时像这样:#include#include#includetemplateusingEigenStdVector=std::vector>;intmain(){EigenStdVectorvec;vec.emplace_back(1.0f,1.0f,1.0f);std::cerr我收到以下警告:Infileincludedfrom/usr/include/eigen3/Eigen/Core:349:0,from/home/igor/Code/eigen_example/e

c++ - 将返回 void 但具有整数参数的函数作为 ARGUMENT 本身传递给另一个函数

我最近开始使用c++开发OpenCV。我在使用以下代码时遇到问题。#include"cv.h"#include"highgui.h"intg_slider_position=0;CvCapture*g_capture=NULL;voidonTrackbarSlide(intpos){cvSetCaptureProperty(g_capture,CV_CAP_PROP_POS_FRAMES,pos);}intmain(intargc,char**argv){cvNamedWindow("Example3",CV_WINDOW_AUTOSIZE);g_capture=cvCreateFil

c++ - 为什么我收到错误 : initializing argument 1 of 'Item::Item(int)' [-fpermissive] in Eclipse when I try to compile my C++ code?

我是C++的新手,在盯着它看了太久之后终于放弃了尝试编译它。编译器似乎出于某种原因拒绝了头文件中的构造函数原型(prototype)......我无法弄清楚它有什么问题。项目.h:#ifndefITEM_H_#defineITEM_H_classItem{public:Item(int);//ThislineiswhatEclipsekeepsflaggingupwiththeerrorinthetitlevirtual~Item();Item*getNextPtr();intgetValue();voidsetNextPtr(Item*);};#endif/*ITEM_H_*/在我的

c++ - 错误 : Use of class template requires template argument list

当我尝试运行我的程序时,此错误显示为“errorC2955:'FOURTEEN':useofclasstemplaterequirestemplateargumentlist”#includeusingnamespacestd;templateclassFOURTEEN{private:Ta[n];public:voidReadData();voidDisplayData();};voidFOURTEEN::ReadData(){for(inti=0;i>a.[i];}voidFOURTEEN::DisplayData(){for(inti=0;i>a.[i]P;//Readdatai

c++ - xutility.h 错误 C2064 : term does not evaluate to a function taking 2 arguments

我有问题要问。我创建了一个名为AstarPlanlama的类并具有以下2个函数:boolAstarPlanlama::nodeComp(constNode*lhs,constNode*rhs){returnlhs->FF;}voidAstarPlanlama::enKucukFliNodeBul(std::list*OPEN){std::list::iteratorit=std::min_element(OPEN->begin(),OPEN->end(),&AstarPlanlama::nodeComp);OPEN->sort(&AstarPlanlama::nodeComp);Q=O

c++ - 候选函数不可行 : 1st argument ('const Node *' ) would lose const qualifier

我正在使用内置的C++编写有向图(有向图)类unordered_map>数据结构,其中Node和Edge是我自己定义的两个结构体。在类里面我写了一个containsNode()搜索Node的方法在图中。这是containsNode()方法体:boolDiGraph::containsNode(constNode*n)const{auto::const_iteratorit=digraph.find(n);return(it==digraph.end());}digraph是unordered_map>类型的DiGraph的私有(private)成员.但是,编译器会生成以下错误:erro

c++ - 了解 "template argument is invalid"错误消息

考虑代码:#include#includestructtest1{voidInvoke(){};};structtest2{templatevoidInvoke(){};};enumclassInvokableKind{NOT_INVOKABLE,INVOKABLE_FUNCTION,INVOKABLE_FUNCTION_TEMPLATE};templatestructget_invokable_kind{conststaticInvokableKindvalue=InvokableKind::NOT_INVOKABLE;};templatestructget_invokable_ki

c++ - 错误 : no instance of overloaded function "std::make_shared" matches the argument list

查看ApreviousstackQuestionstd:make_sharedvsstd::shared_ptr,我试图在一个uni项目中实现它。这是之前的“问题”:Ican'tthinkofanysituationwherestd::shared_ptrobj(newObject("foo",1));wouldbepreferredtoautoobj=std::make_shared("foo",1);因此我采用了这段代码:std::shared_ptrpT1(newTriangle(pCanvas,30,30,30,60,60,30,255,0,0));并将其修改为这段代码:aut

c++ - 哪个更好 : returning tuple or passing arguments to function as references?

我创建的代码中有两个函数returnValues和returnValuesVoid。一个返回2个值的元组,另一个接受参数对函数的引用。#include#includestd::tuplereturnValues(constinta,constintb){returnstd::tuple(a,b);}voidreturnValuesVoid(int&a,int&b){a+=100;b+=100;}intmain(){auto[x,y]=returnValues(10,20);std::cout我读到了http://en.cppreference.com/w/cpp/language/st