当同时使用Steamworks和SFML时,程序退出时会引发异常:
Exception thrown at 0x00007FFA919D024E (ntdll.dll) in Project1.exe: 0xC0000005: Access violation reading location 0x0000000000000010.
我已将程序还原为最基本的内容,但仍然遇到问题:
#include <SFML/Graphics.hpp>
#include <steam/steam_api.h>
int main()
{
SteamAPI_Init();
sf::RenderWindow window(sf::VideoMode::getDesktopMode(), "Title", sf::Style::Close);
while (window.isOpen())
{
sf::Event e;
while (window.pollEvent(e))
{
switch (e.type)
{
case sf::Event::Closed:
{
window.close();
break;
}
}
}
}
SteamAPI_Shutdown();
return 0;
}
答案 0 :(得分:0)
因此,事实证明,该解决方案就像创建窗口之后将Steamworks API初始化移至一样简单。
#include <SFML/Graphics.hpp>
#include <steam/steam_api.h>
int main()
{
sf::RenderWindow window(sf::VideoMode::getDesktopMode(), "Title", sf::Style::Close);
SteamAPI_Init();
while (window.isOpen())
{
sf::Event e;
while (window.pollEvent(e))
{
switch (e.type)
{
case sf::Event::Closed:
{
window.close();
break;
}
}
}
}
SteamAPI_Shutdown();
return 0;
}