gpt4 book ai didi

ubuntu - 如何在 ubuntu 上运行 steamworks 示例

转载 作者:行者123 更新时间:2023-12-04 19:17:26 26 4
gpt4 key购买 nike

  • 我下载了the Steamworks SDK .
  • 里面有一个 Steamworks 示例。当我执行命令 makesteamworksexample文件夹失败并出现错误:
    steam/sdk/steamworksexample$ make steam/sdk/steamworksexample/../tools/linux/bin/g++ -g -DPOSIX -DSDL -I/home/steam/sdk/steamworksexample/../tools/linux/runtime/i386/usr/include/SDL2 -D_REENTRANT -DGNUC -O0 -I/home/steam/sdk/steamworksexample/../public -DDEBUG   -c Inventory.cpp -o debug/Inventory.o -MD -MF debug/Inventory.dep

    Inventory.cpp: In member function 'void CSpaceWarLocalInventory::OnSteamInventoryFullUpdate(SteamInventoryFullUpdate_t*)': Inventory.cpp:61:61: error: 'nullptr' was not declared in this scope Inventory.cpp: In member function 'void CSpaceWarLocalInventory::OnSteamInventoryResult(SteamInventoryResultReady_t*)': Inventory.cpp:131:62: error: 'nullptr' was not declared in this scope Inventory.cpp: In member function 'void CSpaceWarLocalInventory::DoExchange()': Inventory.cpp:218:18: error: 'nullptr' was not declared in this scope Inventory.cpp: In member function 'void CSpaceWarLocalInventory::GrantTestItems()': Inventory.cpp:243:35: error: 'nullptr' was not declared in this scope Inventory.cpp: In member function 'const CSpaceWarItem* CSpaceWarLocalInventory::GetItem(SteamItemInstanceID_t) const': Inventory.cpp:254:9: error: 'nullptr' was not declared in this scope Inventory.cpp: In member function 'const CSpaceWarItem* CSpaceWarLocalInventory::GetInstanceOf(SteamItemDef_t) const': Inventory.cpp:276:9: error: 'nullptr' was not declared in this scope Inventory.cpp: In member function 'void CSpaceWarLocalInventory::RefreshFromServer()': Inventory.cpp:283:33: error: 'nullptr' was not declared in this scope make: *** [debug/Inventory.o] Error 1

  • 我正在使用 Ubuntu 14.04.3 LTS。
  • 最佳答案

    我刚刚得到了 steamworks 示例,可以在我的 Ubuntu 14.04 计算机上构建和运行。我没有很好的解决方案,但有一些 hacky 解决方案。

    简短的解决方案是运行(您需要在此处修改包含路径到您拥有此代码的任何目录):

    make CFLAGS="-std=c++0x -include /home/bbales2/sdk/public/steam/steamtypes.h -I/home/bbales2/sdk/tools/linux/runtime-release/amd64/usr/include/SDL2/ -DSDL=1"

    这将编译一些东西,但会 失败编译“glew.c”。要编译此文件,您需要从该 make 中删除 steamtypes 包含并再次运行它,如下所示:
    make CFLAGS="-std=c++0x -I/home/bbales2/sdk/tools/linux/runtime-release/amd64/usr/include/SDL2/ -DSDL=1"

    glew.c 编译后,make 会再次失败。重新运行第一个 make 命令,最终事情应该完成。使用“debug/SteamworksExample.sh”运行示例

    更详细地说,我遇到的错误列在这里。我们可以用 CFLAGS 修复它们:
    error: 'nullptr' was not declared in this scope

    要解决这个问题,你需要告诉你的编译器是 C++11。这是“-std=c++0x”标志
    GameEngine.h:129:52: error: 'uint32' has not been declared
    GameEngine.h:129:67: error: 'uint32' has not been declared
    GameEngine.h:132:52: error: 'byte' has not been declared
    GameEngine.h:132:65: error: 'uint32' has not been declared
    GameEngine.h:132:80: error: 'uint32' has not been declared
    GameEngine.h:135:52: error: 'DWORD' has not been declared

    有一个 header sdk/public/steam/steamtypes.h 定义了这些。由于某种原因,默认情况下它没有被包含在内。这是“-include/home/bbales2/sdk/public/steam/steamtypes.h”标志。
    gameenginesdl.h:18:17: fatal error: SDL.h: No such file or directory

    缺少 SDL header 。 Valve 将它们包含在 sdk/tools/linux/runtime-release/amd64/usr/include/SDL2/中,但 Makefile 没有检测和添加它们。这是“-I/home/bbales2/sdk/tools/linux/runtime-release/amd64/usr/include/SDL2/”标志。
    In file included from <command-line>:0:0:
    /home/bbales2/sdk/public/steam/steamtypes.h:107:15: error: variably modified 'Salt_t' at file scope
    /home/bbales2/sdk/public/steam/steamtypes.h:123:1: error: initializer element is not constant
    make: *** [debug/glew.o] Error 1

    我们收到此错误是因为我们在编译此文件时无法包含 steamtypes.h(使用 -include 标志强制包含这样的内容不是一个好主意)。只需删除 steamtypes 包括,重新运行 make 来编译这个文件,然后添加 steamtypes include 回来(对于编译的其余部分)似乎工作。


    Main.cpp:248:2: error: #error Need CreateGameEngine()
    ... (bunch of Warnings)
    Main.cpp: In function 'int RealMain(const char*, HINSTANCE, int)':
    Main.cpp:251:2: error: expected primary-expression before 'if'
    Main.cpp:251:2: error: expected ',' or ';' before 'if'
    make: *** [debug/Main.o] Error 1

    Main.cpp 似乎要我们定义 SDL 宏。我们用“-DSDL=1”来做到这一点

    关于ubuntu - 如何在 ubuntu 上运行 steamworks 示例,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32452155/

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