草庐IT

selector-no

全部标签

c++ - G++ 4.5 错误 : No diagnostic for narrowing in initializer list

我尝试了以下代码:intmain(){intx{23.22};}其中包括需要缩小的初始化,但代码编译正常,没有任何错误或警告。另一方面,以下代码给出了错误:intmain(){intx[]{23.22};}我是发现了错误还是什么?PS:我目前使用的是GCC4.5.0 最佳答案 看起来像一个错误。以下直接来自n3092草案:8.5.4List-initialization—Otherwise,iftheinitializerlisthasasingleelement,theobjectisinitializedfromthatelem

c++ - 错误 C2678 : binary '=' : no operator found which takes a left-hand operand of type 'const Recipe' (or there is no acceptable conversion)

我正在尝试对每个元素中包含一个int和一个字符串的vector进行排序。它是一个称为vector食谱的类类型的vector。出现上述错误,这是我的代码:在我的Recipe.h文件中structRecipe{public:stringget_cname()const{returnchef_name;}private:intrecipe_id;stringchef_name;在我的Menu.cpp文件中voidMenu::show()const{sort(recipes.begin(),recipes.end(),Sort_by_cname());}在我的Menu.h文件中#include

c++ - CRTP + 特征类 : "no type named..."

我尝试使用模板化类实现CRTP,但在使用以下示例代码时出现错误:#includetemplateclassTraits{public:typedeftypenameT::typetype;//'staticconstunsignedintm_const=T::m_const;staticconstunsignedintn_const=T::n_const;staticconstunsignedintsize_const=T::m_const*T::n_const;};templateclassCrtp{public:typedeftypenameTraits::typecrtp_typ

如何彻底禁用笔记本电脑的键盘或者禁用笔记本的触控屏,及禁用后如何恢复,解决笔记本电脑蓝屏信息显示:“systern thread exception no handled” 失败操作“etd.sys

目录测试键盘是否失灵的软件针对场景网上教的方法——卸载掉PC/AT增强型PS/2键盘(101/102键)具体做法我推荐的做法——禁用笔记本的PC/AT增强型PS/2键盘(101/102键)禁用笔记本键盘(PC/AT增强型PS/2键盘(101/102键)方法禁用了笔记本键盘后虚拟键盘调用方式恢复笔记本键盘(PC/AT增强型PS/2键盘(101/102键)方法如果在笔记本电脑误操作禁用了HTD驱动导致电脑蓝屏开不了机怎么办(现象)笔记本电脑蓝屏,蓝屏信息显示:“systernthreadexceptionnohandled”或者失败操作“etd.sys”解决办法:在进入不到系统时修改ETD.sys

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*作为第一个参数。

c++ - Opencv 错误 : no GPU support (library is compiled without CUDA support)

我正在尝试使用CUDA在GPU上使用opencv处理一些图像处理任务。我正在使用ubuntu。我毫无问题地设置了我的两个产品Opencv和Cuda,我确信这一点。但是,当我尝试在eclipse中运行sampleCOde时,出现错误:OpenCV错误:在mallocPitch中没有GPU支持(库在没有CUDA支持的情况下编译),文件/home/muad/Source/OpenCV-2.4.2/modules/core/src/gpumat.cpp,第749行我重做了我的opencv,但我还是明白了。 最佳答案 如文档中所述,您必须使用

c++ - 迭代器模式 - 错误 C2679 : binary '<<' : no operator found which takes a right-hand operand of type 'std::string'

这个问题在这里已经有了答案:errorC2679:binary'(1个回答)关闭5年前。我正在尝试使用迭代器模式进行迭代和打印,但出现错误这里是错误:errorC2679:binary'couldbe'std::basic_ostream&std::operator>(std::basic_ostream&,constchar*)'这是错误的来源std::coutgetName();#ifndef_ROBOT1_#define_ROBOT1_namespaceguitars{namespaceComposite{namespaceInventoryParts{usingnamespac

c++ - Netbeans远程C++开发 "No rule to make target"错误

在Netbeans中创建一个简单的远程C++开发应用程序时,出现以下错误:gmake[2]:Enteringdirectory'/path/to/project'gmake[2]:***Noruletomaketarget'/path/to/project/cpp/file'gmake[2]:Leavingdirectory'/path/to/project'BUILDFAILED(exitvalue2,totaltime:1s)要重现此错误,我只需创建一个新的C/C++项目,选择一个我已经配置的远程主机。当我添加具有相应.h文件的.ccp文件时,出现此错误。我什至不必使用或包含这些文

c++ - 智能感知 : namespace "MSXML2" has no member "DOMDocument" in VS2012

我正在尝试编译我继承的项目,然后遇到了这个错误。以下是一些相关代码:#include...HRESULThr;hr=pDoc.CreateInstance(__uuidof(MSXML2::DOMDocument));有人可以帮忙吗? 最佳答案 我在Windows8中看到了类似的问题。似乎MSXML6.0没有公开DOMDocument,但它确实公开了DOMDocument60。为了帮助其他人通过搜索到达这里,您可能还会看到的编译器错误是:错误C2039:“DOMDocument”:不是“MSXML2”的成员尝试进行以下更改以明确使用

c++ - 谷歌模拟 : "no appropriate default constructor available"?

将VisualStudio2010C++与googlemock结合使用。我正在尝试使用我创建的模拟,但在线上遇到编译器错误:EmployeeFakeemployeeStub;错误是:1>c:\someclasstests.cpp(22):errorC2512:'MyNamespace::EmployeeFake':noappropriatedefaultconstructoravailable假员工:classEmployeeFake:publicEmployee{public:MOCK_CONST_METHOD0(GetSalary,double());}员工:classEmploy