gpt4 book ai didi

c++ - 尝试将游戏移植到 Linux 时,调用 XInitThreads 出现语法错误

转载 作者:太空宇宙 更新时间:2023-11-04 05:50:51 30 4
gpt4 key购买 nike

下面是有问题的行在代码中的样子:

#ifdef SFML_SYSTEM_LINUX
XInitThreads();
#endif

我在代码开头调用了必需的库,如下所示:

#ifdef SFML_SYSTEM_LINUX
#include <X11/Xlib.h>;
#include <unistd.h>
#include <pwd.h>
#include <iostream>
#include <stdlib.h>
#endif

它在 Code::Blocks 中给了我这个错误:

error: expected constructor, destructor, or type conversion before ‘;’ token

此错误引用了代码中的第 111 行,即我上面引用的第一个函数中的 XInitThreads 调用。

我错过了什么吗?我尝试过设置链接器以包含 X11 库,但到目前为止它还没有改变任何东西。

编辑:这是 game.cpp 开头的更多代码 - http://pastebin.com/7D2WLRM7

最佳答案

您似乎正在尝试在任何函数或方法 block 之外“调用”此函数。

你的编译器无法理解你想要做什么。也许将这些行移动到 Game::Init 中?

关于c++ - 尝试将游戏移植到 Linux 时,调用 XInitThreads 出现语法错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38509003/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com