jjzjj

argument

全部标签

c++ - OpenCV SVM 在火车上抛出异常, "Bad argument (There is only a single class)"

我卡在这个了。我正在尝试通过OpenCV特征2d框架进行一些对象分类,但在训练我的SVM时遇到了麻烦。我能够提取词汇表并使用BowKMeansTrainer对它们进行聚类,但在我从训练数据中提取特征以添加到训练器并运行SVM.train方法后,出现以下异常。OpenCVError:Badargument(Thereisonlyasingleclass)incvPreprocessCategoricalResponses,file/home/tbu/prog/OpenCV-2.4.2/modules/ml/src/inner_functions.cpp,line729terminatec

c++ - std::map.insert "could not deduce template argument for..."

我正在尝试熟悉STL库,但我无法理解我的编译错误。我使用编译器错误字符串“无法推断...的模板参数”搜索了其他问题,但没有一个答案似乎适用或相关。Error4errorC2784:'boolstd::operator&,conststd::unique_ptr&)':couldnotdeducetemplateargumentfor'conststd::unique_ptr&'from'conststd::string'c:\programfiles(x86)\microsoftvisualstudio10.0\vc\include\xfunctional125我正在编写一个简单的解释

c++ - "more than one instance of overloaded function "标准::战俘 "matches the argument list"

使用C++,我尝试#defineTINYstd::pow(10,-10)我为定义了TINY的类(.h)提供了带有#include和命名空间信息的代码#pragmaonce#include"MMath.h"#include#include#includeusingnamespacestd;#defineTINYstd::pow(10,-10)我在.cpp文件中的一些函数实现中使用了TINY,而TINY给出了错误IntelliSense:morethanoneinstanceofoverloadedfunction"std::pow"matchestheargumentlist什么是正确的

c++ - 构造函数中的奇怪 "candidate expects 1 argument, 0 provided"

我正在用C++制作一个简单的线程服务器应用程序,事实上,我使用libconfig++来解析我的配置文件。好吧,libconfig不支持多线程,因此我使用两个包装类来完成“支持”。重点是,其中一个失败了:classapp_config{friendclassapp_config_lock;public:app_config(char*file):cfg(newlibconfig::Config()),mutex(newboost::mutex()){cfg->readFile(file);}private:boost::shared_ptrcfg;boost::shared_ptrmut

c++ - enable_if : minimal example for void member function with no arguments

我试图更好地理解C++11中的std::enable_if并且一直在尝试编写一个最小的示例:一个类A带有成员函数voidfoo()根据类模板中的类型T具有不同的实现。下面的代码给出了期望的结果,但我还没有完全理解它。为什么版本V2有效,但V1无效?为什么需要“冗余”类型U?#include#includetemplateclassA{public:A(Tx):a_(x){}//EnablethisfunctionifT==int/*V1*///template::value,int>::type=0>/*V2*/template::value,int>::type=0>voidfoo(

c++ - "could not convert template argument"指针参数错误,即使使用强制转换

假设我有一个声明如下的模板类:templatestructy{int*b;y(){b=x;}}我确实需要模板参数是一个常量内存地址——它是一个嵌入式代码。如果我尝试像这样实例化它:(编译器是带有-std=gnu++11的gcc4.8.1)yc;我会收到错误消息“无法将模板参数‘1’转换为‘int*’”,这没关系,而且符合标准。我明白。我的问题是转换为指针也不起作用:yd;y(1)>e;error:couldnotconverttemplateargument'1u'to'int*'在这两种情况下。这是为什么?模板参数已经转换,不是吗? 最佳答案

c++ - 在抛出 'std::invalid_argument' what() : stoi 实例后终止调用

stoi函数使程序崩溃并显示错误消息"****@****:~>g++-std=c++0xm1.cppstimulation.hstims.hTask.hexoskeleton.hARAIG_Sensors.hProfile.hARAIG_Sensors.h:1:9:warning:#pragmaonceinmainfile[enabledbydefault]Profile.h:1:9:warning:#pragmaonceinmainfile[enabledbydefault]*****@****:~>a.outStimulationConfig.csvTaskConfiguratio

c++ - 我可以使用 foo<T..., int, U...> 这样的模式部分特化模板吗?

如果可能的话,可以在不递归的情况下索引可变参数模板参数包。但是,GCC是refusingtopickupmypartialspecialization这里:templatestructelement_impl;templatestructelement_impl...,pair,pair...>>{typedefTtype;};prog.cpp:Ininstantiationof'element>':prog.cpp:52:34:instantiatedfromhereprog.cpp:47:79:error:invaliduseofincompletetype'structeleme

c++ - OpenMp 任务 : can't pass argument by reference

g++-fopenmpmain.cpp提示未定义对std::vector的引用。如何解决这个问题?我已经在Ubuntu上安装了libomp-dev包。主要.cpp#include#includetemplateTrecursiveSumBody(std::vector&vec){Tsum=0;#pragmaomptaskshared(sum){sum=recursiveSumBody(vec);}returnvec[0];}intmain(){std::vectora;recursiveSumBody(a);return0;}undefinedreference/tmp/ccTDECN

c++ - Qt - 获取 "warning: format not a string literal and no format arguments"

在这样的行上不断收到警告qDebug("Anerroroccuredwhiletryingtocreatefolder"+workdir.toAscii());workdir是QString()warning:formatnotastringliteralandnoformatarguments 最佳答案 大概应该是:qDebug("Anerroroccuredwhiletryingtocreatefolder%s",workdir.constData());自qDebug将constchar*作为第一个参数。