草庐IT

make_scoped

全部标签

c++ - "No rule to make target ' 安装 '"... 但是 Makefile 存在

我在安装C++库时遇到问题。CMake命令成功并生成Makefile,但它给出警告:CMakeWarning(dev)atCMakeLists.txt:27(LINK_DIRECTORIES):Thiscommandspecifiestherelativepath../usr/local/libasalinkdirectory.PolicyCMP0015isnotset:link_directories()treatspathsrelativetothesourcedir.Run"cmake--help-policyCMP0015"forpolicydetails.Usethecmak

【问题解决】make[2]: *** 没有规则可制作目标“/usr/lib/x86_64-linux-gnu/libopencv_XXX错误

记录一下使用ubuntu中的各种问题【问题详述】make[2]:***没有规则可制作目标“/usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.4.2.0”,由“/home/victor/cooperate/ur5_husky/devel/lib/libmoveit_lazy_free_space_updater.so.1.1.13”需求。停止。make[1]:***[CMakeFiles/Makefile2:26268:moveit/moveit_ros/perception/lazy_free_space_updater/CMakeFiles/mov

c++ - 这个私有(private)变量 "not declared in this scope"怎么样?

我目前正在尝试学习更多有关C++面向对象设计的知识(熟悉Java),但遇到了一些困难。我试图将这个项目放在一起,以在使用SFML构建图形和音频的游戏中学习这些原则。我有以下两个文件。WorldObject.h#ifndefWORLDOBJECT_H#defineWORLDOBJECT_H#include#include#include"ImageManager.h"classWorldObject{private:sf::Sprite_sprite;voidSetImagePath(std::stringpath);sf::SpriteGetGraphic();};#endif世界对象

c++ - eclipse 太阳神 - "cannot run program make; unknown reason"

我将Eclipse从Galileo升级到Helios,当我尝试执行“清理项目”时,我收到一条错误消息“无法运行程序制作;未知原因”。我能够在Galileo中运行make,所以我不确定为什么会发生这种情况,以及是否有其他人遇到过这种情况。 最佳答案 将PATH添加到环境中(首选项->C/C++->构建->环境)。我还必须将$ORACLE_HOME添加到环境中(我的代码使用Pro*C)——看起来CDT没有像以前那样获取用户的环境变量。这很烦人,我知道... 关于c++-eclipse太阳神-

scope / 作用域(C变量的作用域)

scope/作用域(C变量的作用域)参考:CPrimerPlus第6版第12章存储类别、链接和内存管理目录scope/作用域(C变量的作用域)1.定义2.分类2.1.blockscope/块作用域2.1.1.定义2.1.2.函数的形式参数2.1.3.没有花括号的块2.2.functionscope/函数作用域2.3.functionprototypescope/函数原型作用域2.4.filescope/文件作用域3.总结1.定义描述程序中可以访问identifier(标识符)的区域2.分类scope可以分为四类:2.1.blockscope/块作用域2.1.1.定义block/块是用一块花括号

c++ - new 和 make_shared 用于共享指针

我遇到了this@kerekSB状态的帖子和答案之一std::shared_ptrp1=std::make_shared("foo");std::shared_ptrp2(newObject("foo"));Inyourcode,thesecondvariableisjustanakedpointer,notasharedpointeratall.Nowonthemeat.make_sharedis(inpractice)moreefficient,becauseitallocatesthereferencecontrolblocktogetherwiththeactualobject

c++ - std::make_pair:无法将 'ch'(类型 'char')转换为类型 'char&&'

这个问题在这里已经有了答案:C++11make_pairwithspecifiedtemplateparametersdoesn'tcompile(1个回答)关闭9年前。以下代码有什么问题:#include#include#include#include#includeintmain(){std::vector>vec;for(unsignedi=0;i(ch,number))!=vec.end());std::cout(ch,number));}}它确实可以很好地编译:g++test.cxx但失败了:$g++-std=c++11test.cxx/tmptest.cxx:Infunct

c++ - boost::make_shared 不是在调用(放置)运算符 new 吗?

我第一次使用boost::make_shared来创建共享指针指向的对象。主要是因为我们的代码太慢了,单次分配确实有助于boost性能。在以“硬手动方式”修复了一些内存泄漏之后,我决定通过覆盖所有相关类的新运算符来实现一个简单的内存泄漏检测器,仅用于计算在我们的应用程序的特定点哪些对象仍然存在。我之前已经实现过几次,惊讶地发现我的代码不再检测到任何对象。我认为我所要做的就是覆盖“placementnew”而不是“normal”operatornew,因为make_shared的boost网站文档中有以下内容:"Effects:Allocatesmemorysuitableforanob

c++ - 在 scoped_ptr 出现异常时不调用析构函数

我刚刚开始使用C++boost库。我在很多地方读到,当使用scoped_ptr时,即使出现异常,对象也总是被销毁。Theybehavemuchlikebuilt-inC++pointersexceptthattheyautomaticallydeletetheobjectpointedtoattheappropriatetime.Smartpointersareparticularlyusefulinthefaceofexceptionsastheyensureproperdestructionofdynamicallyallocatedobjects.我尝试了以下代码。#includ

C++ 编译器错误 "was not declared in this scope"

我在尝试编译C++UDP客户端程序时遇到奇怪的编译器错误。g++-oclientUdp.cppClientMain.c-I.-lpthreadInfileincludedfromClientMain.c:1:0:Udp.h:Indestructor‘CUdpMsg::~CUdpMsg()’:Udp.h:103:43:error:‘free’wasnotdeclaredinthisscopeUdp.h:Inmemberfunction‘voidCUdpMsg::Add(in_addr_t,constvoid*,size_t)’:Udp.h:109:34:error:‘malloc’was