我试图让Irrlicht使用我在X11下使用SDL2创建的窗口,但它在Irrlicht中失败了GLXCreateWindow.
在我的方框中,以下MCVE再现了该问题:
#include <irrlicht/irrlicht.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_syswm.h>
int main()
{
SDL_Init(SDL_INIT_VIDEO);
SDL_Window* window = SDL_CreateWindow("Hello",
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
800, 600,
SDL_WINDOW_OPENGL);
if (!window)
{
return false;
}
SDL_SysWMinfo wm_info;
SDL_VERSION(&wm_info.version);
if (!SDL_GetWindowWMInfo(window, &wm_info))
{
return false;
}
irr::SIrrlichtCreationParameters params;
params.DeviceType = irr::EIDT_BEST;
params.DriverType = irr::video::EDT_OPENGL;
params.WindowSize = { 800, 600 };
params.WindowId = reinterpret_cast<void*>(wm_info.info.x11.window);
irr::createDeviceEx(params);
}
Run Code Online (Sandbox Code Playgroud)
这会导致以下错误:
Irrlicht Engine version 1.9.0
Linux 4.16.16-1-ck #1 SMP PREEMPT Tue Jun 19 20:30:54 CEST 2018 x86_64
X Error of failed request: …Run Code Online (Sandbox Code Playgroud) 提供以下代码,在全局范围内,clang-tidy不提供警告:
auto test = []{};
Run Code Online (Sandbox Code Playgroud)
但是,在执行以下操作时,它会:
#include <tuple>
auto test = []{
std::tuple t{1, 2, 3};
};
Run Code Online (Sandbox Code Playgroud)
Run Code Online (Sandbox Code Playgroud)<source>:3:6: warning: initialization of 'test' with static storage duration may throw an exception that cannot be caught [cert-err58-cpp] auto test = []{ ^ /opt/compiler-explorer/gcc-8.2.0/lib/gcc/x86_64-linux-gnu/8.2.0/../../../../include/c++/8.2.0/tuple:646:19: note: possibly throwing constructor declared here constexpr tuple(_UElements&&... __elements) ^
将lambda标记为noexcept没有用.
但是,我不明白为什么会出现这个问题.异常只能在调用 lambda 时理论上发生,不是吗?
以下代码不会导致出现警告:
auto test = [] {
throw 0;
};
Run Code Online (Sandbox Code Playgroud)
铿锵有误,还是我错过了什么?