【问题标题】:Steam Callbacks Trigger Warning During Compile In Linux / GCC在 Linux / GCC 中编译期间 Steam 回调触发警告
【发布时间】:2020-04-24 09:25:08
【问题描述】:

我从事 Steamworks 集成工作已有一段时间了,每次在 Linux 上编译时,我的所有回调都会触发此警告。每个人一个,所以有一堵墙。话虽如此,回调工作得很好。

module.h: In member function 'virtual void Steam::CCallbackInternal__steam_api_call_completed::Run(void*)':
module.h:667:18: warning: offsetof within non-standard-layout type 'Steam' is conditionally-supported [-Winvalid-offsetof]
  667 |   STEAM_CALLBACK(Steam, _steam_api_call_completed, SteamAPICallCompleted_t);
sdk/public/steam/steam_api_internal.h:39:58: note: in expansion of macro '_STEAM_CALLBACK_3'
   39 | #define _STEAM_CALLBACK_HELPER( _1, _2, SELECTED, ... )  _STEAM_CALLBACK_##SELECTED
      |                                                          ^~~~~~~~~~~~~~~~
sdk/public/steam/steam_api_common.h:99:2: note: in expansion of macro '_STEAM_CALLBACK_SELECT'
   99 |  _STEAM_CALLBACK_SELECT( ( __VA_ARGS__, 4, 3 ), ( /**/, thisclass, func, __VA_ARGS__ ) )
      |  ^~~~~~~~~~~~~~~~~~~~~~
module.h:667:3: note: in expansion of macro 'STEAM_CALLBACK'
  667 |   STEAM_CALLBACK(Steam, _steam_api_call_completed, SteamAPICallCompleted_t);
      |   ^~~~~~~~~~~~~~
module.h: In member function 'virtual void Steam::CCallbackInternal__steam_shutdown::Run(void*)':
module.h:668:18: warning: offsetof within non-standard-layout type 'Steam' is conditionally-supported [-Winvalid-offsetof]
  668 |   STEAM_CALLBACK(Steam, _steam_shutdown, SteamShutdown_t);
sdk/public/steam/steam_api_internal.h:39:58: note: in expansion of macro '_STEAM_CALLBACK_3'
   39 | #define _STEAM_CALLBACK_HELPER( _1, _2, SELECTED, ... )  _STEAM_CALLBACK_##SELECTED
      |                                                          ^~~~~~~~~~~~~~~~
sdk/public/steam/steam_api_common.h:99:2: note: in expansion of macro '_STEAM_CALLBACK_SELECT'
   99 |  _STEAM_CALLBACK_SELECT( ( __VA_ARGS__, 4, 3 ), ( /**/, thisclass, func, __VA_ARGS__ ) )
      |  ^~~~~~~~~~~~~~~~~~~~~~
module.h:668:3: note: in expansion of macro 'STEAM_CALLBACK'
  668 |   STEAM_CALLBACK(Steam, _steam_shutdown, SteamShutdown_t);

当回调起作用时,想知道是什么导致了这些警告以及如何解决它们。

我正在使用 GCC / G++ 9.2.1 在 Ubuntu Linux 19.10 中编译,供参考。

【问题讨论】:

    标签: c++ linux ubuntu steam steamworks-api


    【解决方案1】:

    我不得不让他们沉默

    #pragma GCC diagnostic push
    #pragma GCC diagnostic ignored "-Winvalid-offsetof"
    
    // my code
    
    #pragma GCC diagnostic pop
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-02-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-25
      • 2020-02-16
      相关资源
      最近更新 更多