草庐IT

add_argument

全部标签

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++ - CMake:包含 vs add_subdirectory:相对头文件路径

我有一个包含多个子目录的C++项目,例如src/CMakeLists.txtmain.cppmodule1/CMakeLists.txtcode.cppcode.hmodule2/CMakeLists.txtcode2.cpp似乎在cmake中处理这个问题的两种方法是在我的src/CMakeLists中使用add_subdirectory(module1)或include(module1).txt。我在某处读到,include使用被视为遗留/弃用。我的src/module1/CMakeLists.txt看起来像这样:include_directories(${CMAKE_CURRENT

c# - "add as link"选项发生了什么?

为什么是addanexistingfileasalink功能仅适用于托管项目?我不能在vcproj中使用相同的功能。是因为托管项目是为msbuild构建的,而vcproj文件不是吗? 最佳答案 添加为链接功能对于VC++项目(无论是否托管)不是必需的,因为VC++项目不要求所有源文件严格驻留在包含该项目的文件夹中。另一方面,C#项目确实有此要求。所以你可以说VC++总是将文件添加为链接并且从不复制它们。您为这种灵active付出的代价是必须创建与磁盘上的真实文件夹不对应的虚拟项目文件夹并自行管理它们。这种传统来自VC6,相信我很多C

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++ - 将 CMake 变量传递给 ExternalProject_Add

我正在使用带有ExternalProject_Add的CMake构建外部库。我使用了答案here生成以下内容(捕获命令行输入到CMake以便将其传递给ExternalProject_Add命令):get_cmake_property(CACHE_VARSCACHE_VARIABLES)foreach(CACHE_VAR${CACHE_VARS})get_property(CACHE_VAR_HELPSTRINGCACHE${CACHE_VAR}PROPERTYHELPSTRING)if(CACHE_VAR_HELPSTRINGSTREQUAL"Nohelp,variablespecif

c++ - CMake add_compile_options 在适当的时候会影响链接器选项吗?

一些编译器选项实际上可能需要额外的链接选项才能真正有效。例如,启用GCC'sLinkTimeOptimization,-flto选项必须在编译命令和链接命令中传递。有一个漂亮的builtincmakecommand用于添加编译选项,但据我所知,没有相应的链接选项命令。即使有,当我使用的编译选项暗示它们时需要明确指定它们也会很烦人。那么add_compile_options(-flto)是否将-flto添加到link命令?如果没有,我是否需要直接设置(LINK_FLAGS....? 最佳答案 add_compile_options和t

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