草庐IT

does_not_have_foo

全部标签

c++ - 为什么 Visual Studio 不在 self 赋值时发出警告 (int foo = foo;)

我在重构一个出现了无数次的术语时不小心产生了如下代码中的情况:#include"stdafx.h"#includeintfoo=foo;//Byreplacingwiththefollowinginstructionwecausesacompileerror//intfoo(foo);int_tmain(intargc,_TCHAR*argv[]){intbar=bar;std::cout对于不同的调试和发布配置,编译器对intfoo=foo;保持沉默。我看不出这种说法不是等待发生的错误。VisualStudio编译器不应该发出警告吗?我并不是假装这是未定义的行为。我的意思是,默认情况

C++标准写法: Does "through all iterators in the range" imply sequentiality?

ThisSOquestion引发了关于std::generate和标准做出的保证的讨论。特别是,你能否使用具有内部状态的函数对象并依赖于generate(it1,it2,gen)来调用gen(),将结果存储在*it,再调用gen(),存入*(it+1)等,还是可以从后面开始,比如?标准(n3337,§25.3.7/1)是这样说的:Effects:Thefirstalgorithminvokesthefunctionobjectgenandassignsthereturnvalueofgenthroughalltheiteratorsintherange[first,last).Thes

c++ - 安装摩西翻译软件。错误消息 : "ld: library not found for -lboost_thread"

我正在使用Xcode6.1的MacOSX10.9.5上安装Moses翻译软件。Theinstructionssay我需要安装g++和Boost。执行此操作后,我将gitclone,“cd”到目录中,然后键入./bjam-j8。首先,我确认我具备先决条件。首先,g++(我只是单击TAB以查看可用的内容):$g++g++g++-4.9然后boost:$brewinstallboostWarning:boost-1.56.0alreadyinstalled然后我尝试安装:$./bjam-j8Tip:installtcmallocforfasterthreading.SeeBUILD-INST

c++ - CMake 错误 : common is required but boost was not found

我正在尝试使用cmake_3.5.0编译opencv_2.4.9以在Qt_5.3.2MinGW中运行一个项目,但它一直显示此错误:Commonneededbutcan'tfindboost我选择“MinGWMakefiles”作为生成器并在配置窗口中“指定native编译器”。我定义了BOOST_ROOT环境变量,这是我的CmakeLists.txt:cmake_minimum_required(VERSION2.8FATAL_ERROR)SET(sampleNameMyApp)set(Boost_USE_STATIC_LIBSON)set(Boost_USE_STATICON)set

c++ - OpenCV - 分配运算符 "not working"?

我有一个计算卷积的函数(测试我们是否使用了正确的filter2D设置),我认为函数体并不重要,所以这里只是标题和结尾:templatecv::Matconv(constcv::Mat&input,constcv::Mat&kernel){cv::Matoutput(input);//orshouldIratheruseoutput(input.rows,input.cols,input.depth())?...returnoutput;}cv::Matresult=conv(input,kernel);此时,我在result中得到了完全无用的结果(这些甚至不是随机数据,它们有一些奇怪的

c++ - 使用 stxxl 队列时为 `pointer being freed was not allocated`

我的代码似乎可以工作(由于上述错误,我还没有在大型数据集上尝试过)。代码:#include#include#includeintmain(){//queueq;//thisworksstxxl::queueq;//doesnotworkfor(inti=0;i我的简单.stxxl就是:disk=./testfile,0,syscall但我的错误是:stackexchangeexample(3884)malloc:***errorforobject0x101c04000:pointerbeingfreedwasnotallocated***setabreakpointinmalloc_e

c++ - CMake "clang++ is not able compile a simple test program"(软呢帽 20)

所以我尝试安装clang+cmake来编译一个简单的C++程序,但出现以下错误:--TheCcompileridentificationisGNU4.8.3--TheCXXcompileridentificationisClang3.5.0--CheckforworkingCcompiler:/usr/bin/cc--CheckforworkingCcompiler:/usr/bin/cc--works--DetectingCcompilerABIinfo--DetectingCcompilerABIinfo-done--CheckforworkingCXXcompiler:/usr/

c++ - OS X Yosemite 升级 : Game not recognized by Game Center

昨天我将OSX升级到Yosemite,从那时起我的游戏就无法被GameCenter识别。GKErrorDomain:代码15和文本:“无法完成请求的操作,因为GameCenter无法识别此应用程序。”我在GameCenter应用程序中检查了Developer->UseSandboxServer但没有结果。另外,再次尝试清理、构建。GCApp好像没有进入沙盒模式?正如我所说,在我升级到Yosemite之前游戏运行良好。感谢任何帮助。 最佳答案 我认为问题可能在于OSXYosemite具有游戏无法支持的新功能,因为该游戏是为较旧版本的操

c++ - fatal error : 'common.h' file not found under mac osx 10. 10.5

我按照操作系统:三个简单的部分这本书,introductionchapter中的代码,#include#include#include#include#include"common.h"intmain(intargc,char*argv[]){if(argc!=2){fprintf(stderr,"usage:cpu\n");exit(1);}char*str=argv[1];while(1){Spin(1);printf("%s\n",str);}return0;}当我尝试gcc-ocpucpu.c-Wall时,错误出来了:fatalerror:'common.h'filenotfo

c++ - 错误 "requested alignment is not an integer constant"

我在解决GCC问题时遇到问题。我在GCC4.8下体验过它,但不是5.1。看起来它被报道了here和/或here.问题如下:templatestructS{staticconstintALIGN=16;__attribute__((aligned(ALIGN)))intx;};intmain(intargc,char*argv[]){Ss1;Ss2;return0;}和:$g++test.cxx-otest.exetest.cxx:9:41:error:requestedalignmentisnotanintegerconstant__attribute__((aligned(ALIGN