我有一个ApiHandler类,该类会初始化所有Steam api内容:
ApiHandler::ApiHandler(int appID) : m_appID(appID)
{
m_errorEvent = gcnew ErrorTrigger();
m_errorHandle = gcnew ErrorHandler();
m_errorEvent->errorEvent += gcnew errorEventHandler(m_errorHandle, &ErrorHandler::errorHandler);
writeIDToFile();
if (SteamAPI_RestartAppIfNecessary(m_appID))
{
m_errorEvent->throwError(E_RESTART_APP);
return;
}
if (!SteamAPI_Init())
{
m_errorEvent->throwError(E_STEAM_NOT_RUNNING);
return;
}
SteamAPI_RunCallbacks();
}
我还有另一个课程,目标是自动回复邮件
#pragma once
class AutoReply
{
public:
AutoReply();
void autoAnswer(GameConnectedFriendChatMsg_t* pCallback);
STEAM_CALLBACK(AutoReply, autoAnswer, GameConnectedFriendChatMsg_t);
~AutoReply();
};
我的问题是,即使我包含具有以下所有标头的pch.h,也得到了未定义的STEAM_CALLBACK函数:
#include "Steam/steam_api.h"
#include <iostream>
#include "ErrorCodes.h"
#include <fstream>
#include "Steam/isteamapplist.h"
#include "Steam/isteamfriends.h"
#include "Steam/isteamclient.h"
#include "Steam/isteamutils.h"
#include "Steam/isteamuser.h"
我遵循了文档中的所有内容,并多次使用SteamAPI_RunCallbacks();打电话。