如何在ubuntu上运行steamworks示例

时间:2015-09-08 07:52:46

标签: ubuntu makefile steam

  1. 我下载了the Steamworks SDK

  2. 里面有一个Steamworks示例。当我在make文件夹中执行命令steamworksexample时,它会失败并显示错误:

    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:在成员函数' void CSpaceWarLocalInventory :: OnSteamInventoryFullUpdate(SteamInventoryFullUpdate_t *)':   Inventory.cpp:61:61:错误:' nullptr'在这方面没有申明   Inventory.cpp:在成员函数' void CSpaceWarLocalInventory :: OnSteamInventoryResult(SteamInventoryResultReady_t *)':   Inventory.cpp:131:62:错误:' nullptr'在这方面没有申明   Inventory.cpp:在成员函数' void CSpaceWarLocalInventory :: DoExchange()':   Inventory.cpp:218:18:错误:' nullptr'在这方面没有申明   Inventory.cpp:在成员函数' void CSpaceWarLocalInventory :: GrantTestItems()':   Inventory.cpp:243:35:错误:' nullptr'在这方面没有申明   Inventory.cpp:在成员函数&#const; const CSpaceWarItem * CSpaceWarLocalInventory :: GetItem(SteamItemInstanceID_t)const':   Inventory.cpp:254:9:错误:' nullptr'在这方面没有申明   Inventory.cpp:在成员函数&const; const CSpaceWarItem * CSpaceWarLocalInventory :: GetInstanceOf(SteamItemDef_t)const':   Inventory.cpp:276:9:错误:' nullptr'在这方面没有申明   Inventory.cpp:在成员函数' void CSpaceWarLocalInventory :: RefreshFromServer()':   Inventory.cpp:283:33:错误:' nullptr'在这方面没有申明   make:*** [debug / Inventory.o]错误1

  3. 我使用的是Ubuntu 14.04.3 LTS。

1 个答案:

答案 0 :(得分:0)

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

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

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 include并再次运行它:

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

有一个标题,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标头。 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 back(对于其余的编译)似乎工作。

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宏。我们用&#34; -DSDL = 1&#34;

来做到这一点