错误:“坏设备”未在此范围内声明
error: ‘BadDevice’ was not declared in this scope
知道为什么我会得到这个错误吗?
error: ‘BadDevice’ was not declared in this scope
我包括:
#include <X11/Xlib.h>
和
#include <X11/extensions/XInput2.h>
在我的类头文件中。
我是这样使用它的:
int ret = XIGrabDevice(display_, 2, LinuxInputManager::getWindow(),
CurrentTime, None, GrabModeAsync,
GrabModeAsync, False, &eventMask_);
if (ret == BadValue)
std::cout << "bad value" << std::endl;
else if (ret == BadDevice)
std::cout << "BadDevice" << std::endl;
if (ret == BadMatch)
std::cout << "BadMatch" << std::endl;
if (ret == BadWindow)
std::cout << "BadWindow" << std::endl;
if (ret) {
std::cout << "not available 3" << std::endl;
}
干杯
加里特
这就是你使用它的方式
int rc;
if ((rc = XIGrabDevice(dpy, 2, win, CurrentTime, None, GrabModeAsync,
GrabModeAsync, False, &mask)) != GrabSuccess)
{
fprintf(stderr, "Grab failed with %dn", rc);
return;
}
或尝试(也尝试使用您的函数)
int rc;
if (!(rc = XIGrabDevice(dpy, 2, win, CurrentTime, None, GrabModeAsync,
GrabModeAsync, False, &mask)))
{
fprintf(stderr, "Grab failed with %dn", rc);
return;
}
似乎要么是BadValue,要么是BadDevice,要么是BadMatch...将是一个 int 值,它们可能不会在头文件中定义,所以我会检查以确保它们在某个地方。因此,请尝试使用 ret 变量。您的错误代码可能是 1、2、3、4,也可能是 1 或 0。您必须自己定义错误代码。
以下是其他人如何使用XIGrabDevice的示例程序:http://people.freedesktop.org/~whot/xi2-recipes/part5.c
相关文章:
- 错误:未在此范围内声明'reverse'
- 错误:"imread"未在此范围内声明
- 未在此范围内声明错误 'xy'
- Socklen_t未在此范围内声明
- 错误:'[' 之前预期的非限定 id 和错误:'users'未在此范围内声明
- "Main"已在当前范围内声明
- c++ 变量在宏的扩展中没有在这个范围内声明
- C++ 在编译过程中 strtok 函数 Eclipse 说没有在范围内声明?
- 'num1'未在此范围内声明
- 如何找到在本地范围内声明的变量的地址?
- NT状态未在此范围内声明
- 变量未在此范围内声明 数组线性搜索
- 包含文件中的 Typdef "未在此范围内声明"
- 'ClassName'和'ClassInstance'未在此范围内声明
- C++ 中的类之间的数据重新循环 - 错误:'<class name>'未在此范围内声明
- 代码作为 C 文件工作,但不作为C++文件,错误:'__builtin_types_compatible_p'未在此范围内声明
- 如何修复错误:"vreinterpretq_u32_f64"未在此范围内声明 - 在Android上使用Eigen构建
- 如何修复C++中的"arrStud未在此范围内声明"错误
- 错误:"SHGetKnownFolderPath"未在此范围内声明
- 错误:'Sprite'未在此范围内声明