草庐IT

initialize-error

全部标签

c++ - Qt 5 beta2, Qt Creator 2.6, MSVC error : Qt Creator needs a compiler set up to build. 在套件选项中配置编译器

这个问题在这里已经有了答案:关闭10年前。PossibleDuplicate:VC++compilerforQtCreator我是新手。我正在尝试在QtCreator2.6中编译以下代码,Qt5betaforwindows随附:#include#includeintmain(intargc,char*argv[]){QCoreApplicationa(argc,argv);qDebug()我收到以下错误:QtCreatorneedsacompilersetuptobuild.Configureacompilerinthekitoptions.Filenotfound:Qtcreator

c++ - 编译器如何传递 `std::initializer_list` 值? (或 : how can I get around a universal overload with one? )

Continuingmysaga,我意识到我可以使用单个std::initializer_list参数来重载我的访问函数:classarray_md{//...my_type&operator[](size_typei){/*Lotsofcode*/}my_typeconst&operator[](size_typei)const{/*sameLotsofcode,with"const"sprinkledin*/}my_type&operator[](std::initializer_listi){/*Lotsofdifferentcode*/}my_typeconst&operato

c++ - OpenCV 2.4.6.1 : Error while grabbing frame from camera

这个问题在这里已经有了答案:Gettingopencverrorinc++(2个答案)关闭5年前。我正在将XCode(OSXMountainLion)与OpenCV结合使用。OpenCV通过自制软件安装(版本2.4.6.1)我的程序应该只访问相机。到目前为止,这是我的代码:usingnamespacecv;intmain(intargc,constchar*argv[]){Matframe;VideoCapturecap(CV_CAP_ANY);if(!cap.isOpened()){std::cerr>frame;if(frame.empty()){std::cerr=0){cap.

qt.network.ssl: QSslSocket::connectToHostEncrypted: TLS initialization failed

方法一:如果是https,改为http。方法二:Qt解决qt.network.ssl:QSslSocket::connectToHostEncrypted:TLSinitializationfailed问题-CSDN博客其他: 

c++ - 使用 Visual Studio 2015 : error C3546 在 lambda 中扩展参数包

正在关注thisquestion,我尝试编译以下代码:templateautofor_each(type_list){return[](auto&&f){usingswallow=int[];(void)swallow{0,(void(f(tag{})),0)...};};}这适用于gcc,但在visualstudio2015中会产生以下错误:main.cpp(19):errorC3546:'...':therearenoparameterpacksavailabletoexpandmain.cpp(48):note:seereferencetofunctiontemplateinst

c++ - C 编译 : error: stray '\4' in program ; octal flow?

正在尝试编译大量.c文件(1)文件编译正常,使用cccc-Wall-Wextra-Wunreachable-code-ggdb-O0*.c(2)然后,我需要根据最终输出创建一个静态库,以在C++程序中使用。所以我这样做:arcruliborientdb-c.a*.o(3)工作正常。但是,当我编译包含第1行库的c++程序testme.cpp时(line1oftestme.cpp)#include"liborientdb-c.a"编译步骤:cctestme.cpp我收到这个错误:liborientdb-c.a:117:22:error:stray'\3'inprogramliborient

C++ 复制构造函数被调用而不是 initializer_list<>

基于这段代码structFoo{Foo(){coutilist){cout输出是:默认构造函数抄袭者抄袭者在第三种情况下,我将b放入应该调用initializer_list构造函数的大括号初始化中。相反,复制构造函数带头。你们有人能告诉我这是如何工作的吗?为什么? 最佳答案 正如NicolBolas所指出的,此答案的原始版本是不正确的:撰写本文时的cppreference错误地记录了在列表初始化中考虑构造函数的顺序。以下是使用标准n4140草案中存在的规则的答案,该标准非常接近官方C++14标准。原答案的文字仍然包含在内,以备记录。

c++ - Microsoft VS C++ 编译器是否存在 Bug Initialize a reference from a temporary object

这个问题在这里已经有了答案:关闭11年前。PossibleDuplicate:Bindingtemporarytoalvaluereference使用VS2008C++编译器编译代码无编译错误。classA{};intmain(){A&a_ref=A();return0;}我相信C++标准,包括C++2003和即将到来的C++0x,都不允许它。而且我还遇到了gcc编译器的编译时错误。所以我想知道的是,这是VS编译器允许从临时对象初始化引用的已知错误。还是VS编译器的功能扩展?如果是,临时对象的生命周期是多少?

c++ - Qt Release build 给出 MSVC++ Runtime Library Error

在Debug模式下构建时,我有一个完美运行的应用程序(带有大约16个DLL的exe)。然而,一旦我切换到Release,获取exe和构建的所有DLL,所有必需的DLL从QtSDKbin复制过来,我就会遇到运行时错误。我应该如何排查发生的问题?这是一个普遍的问题吗?我没有任何入口点等,甚至无法从...开始。只是一个一般的运行时错误。我发现的唯一类似问题是here,但这是来自更旧版本的Qt。4.7.4只有一个bin文件夹。编辑1-除了创建我的MainWindow对象之外,我已经注释了我的main.cpp中的所有内容,以及我的MainWindow构造函数中的所有内容,所以它应该只是打开一个空

c++ - 内存屏障 : How to ensure initialization writes are seen by worker threads?

我对使用内存屏障/栅栏进行编程还很陌生,我想知道我们如何才能保证设置写入在随后在其他CPU上运行的辅助函数中可见。例如,请考虑以下内容:intsetup,sheep;voidSetupSheep()://RunonceCPU1:setup=0;...muchlaterCPU1:sheep=9;CPU1:std::atomic_thread_fence(std::memory_order_release);CPU1:setup=1;之后运行(不是并发),很多很多次:voidManipulateSheep():CPU2:intmySetup=setup;CPU2:std::atomic_t