草庐IT

EGL_BAD_DISPLAY

全部标签

c++ - 为什么 std::exception 在 std::bad_alloc 之前捕获我的异常?

问题:我同时使用std::exception和std::bad_alloc来捕获异常。我正在使用的trycatch的顺序有问题。我附上了示例代码以供引用。预期:如果我的错误是bad_alloc,则抛出bad_alloc异常。观察到:我的错误是bad_alloc,但抛出了异常。示例代码:#include"stdafx.h"#include#includeusingnamespacestd;voidgoesWrong(){boolerror1Detected=true;boolerror2Detected=false;if(error1Detected){throwbad_alloc();

c++ - 为什么 std::exception 在 std::bad_alloc 之前捕获我的异常?

问题:我同时使用std::exception和std::bad_alloc来捕获异常。我正在使用的trycatch的顺序有问题。我附上了示例代码以供引用。预期:如果我的错误是bad_alloc,则抛出bad_alloc异常。观察到:我的错误是bad_alloc,但抛出了异常。示例代码:#include"stdafx.h"#include#includeusingnamespacestd;voidgoesWrong(){boolerror1Detected=true;boolerror2Detected=false;if(error1Detected){throwbad_alloc();

c++ - std::vector 构造函数中的 bad_alloc

std::vector有一个构造函数,其中传递size_typecount的单个参数应该使用count默认构造的元素来调整vector的大小。但以下代码在错误转换后失败并出现bad_alloc异常:#includestructInner{intfoo;charbuf[256];};templatestructOuter{typedefstd::vectorBufContainer;typedeftypenameBufContainer::size_typeBufIndex;BufContainerbufs1;BufContainerbufs2;constBufIndexBUFCOUNT

c++ - std::vector 构造函数中的 bad_alloc

std::vector有一个构造函数,其中传递size_typecount的单个参数应该使用count默认构造的元素来调整vector的大小。但以下代码在错误转换后失败并出现bad_alloc异常:#includestructInner{intfoo;charbuf[256];};templatestructOuter{typedefstd::vectorBufContainer;typedeftypenameBufContainer::size_typeBufIndex;BufContainerbufs1;BufContainerbufs2;constBufIndexBUFCOUNT

c++ - Qt 5.1 没有显示的 QApplication - QXcbConnection : Could not connect to display

我正在使用Qt5.1,我正在尝试创建一个没有显示的QApplication。我需要用QPainter绘制文本,所以我需要使用QApplication(或QGuiApplication),否则会出现段错误。该应用程序在Qt4.8中运行良好,但在Qt5.1中在headless版本的Ubuntu中失败并出现以下错误:"QXcbConnection:Couldnotconnecttodisplay".在Qt4.8中,我能够使用GUIenabled=false的以下构造函数来创建不需要显示的QApplication:QApplication::QApplication(int&argc,char

c++ - Qt 5.1 没有显示的 QApplication - QXcbConnection : Could not connect to display

我正在使用Qt5.1,我正在尝试创建一个没有显示的QApplication。我需要用QPainter绘制文本,所以我需要使用QApplication(或QGuiApplication),否则会出现段错误。该应用程序在Qt4.8中运行良好,但在Qt5.1中在headless版本的Ubuntu中失败并出现以下错误:"QXcbConnection:Couldnotconnecttodisplay".在Qt4.8中,我能够使用GUIenabled=false的以下构造函数来创建不需要显示的QApplication:QApplication::QApplication(int&argc,char

android - 为什么 eglMakeCurrent() 因 EGL_BAD_MATCH 而失败?

我正在使用opengl/egl为Android开发。我的应用需要第二个上下文来从第二个线程加载纹理。我的代码在android2.3上运行良好,但是当我在4.0.3android设备或模拟器上尝试该代码时,eglMakeCurrent()失败并显示EGL_BAD_MATCH。第二个上下文的初始化和它的像素缓冲区也都工作正常,所以我不确定从哪里开始寻找这个错误。这是初始化代码:ANativeWindow*window=(ANativeWindow*)displaySurface;EGLintdummy,format;display=eglGetDisplay(EGL_DEFAULT_DIS

android - 为什么 eglMakeCurrent() 因 EGL_BAD_MATCH 而失败?

我正在使用opengl/egl为Android开发。我的应用需要第二个上下文来从第二个线程加载纹理。我的代码在android2.3上运行良好,但是当我在4.0.3android设备或模拟器上尝试该代码时,eglMakeCurrent()失败并显示EGL_BAD_MATCH。第二个上下文的初始化和它的像素缓冲区也都工作正常,所以我不确定从哪里开始寻找这个错误。这是初始化代码:ANativeWindow*window=(ANativeWindow*)displaySurface;EGLintdummy,format;display=eglGetDisplay(EGL_DEFAULT_DIS

C++ 错误 : terminate called after throwing an instance of 'std::bad_alloc'

我在eclipse上使用下面的代码,我得到一个错误终止“在抛出'std::bad_alloc'what():std::bad_alloc的实例后调用”。我有RectInvoice类和Invoice类。classInvoice{public://......otherfunctions.....private:stringname;Matim;intwidth;intheight;vectorrectInvoiceVector;};我在Invoice的方法中使用下面的代码。//vect:vector*vect;RectInvoicerect(vect,im,x,y,w,h);this->

C++ 错误 : terminate called after throwing an instance of 'std::bad_alloc'

我在eclipse上使用下面的代码,我得到一个错误终止“在抛出'std::bad_alloc'what():std::bad_alloc的实例后调用”。我有RectInvoice类和Invoice类。classInvoice{public://......otherfunctions.....private:stringname;Matim;intwidth;intheight;vectorrectInvoiceVector;};我在Invoice的方法中使用下面的代码。//vect:vector*vect;RectInvoicerect(vect,im,x,y,w,h);this->