該項目建立在Win32平臺上,但不在x64上。LNK2001:爲x64平臺構建時無法解析的外部符號
完整的錯誤消息: dllentry.obj:錯誤LNK2001:無法解析的外部符號 「類CFactoryTemplate * g_Templates」(g_Templates @@ 3PAVCFactoryTemplate @@?A)
的dllentry.cpp兩個平臺上編譯。它包含外部聲明:
extern CFactoryTemplate g_Templates[];
extern int g_cTemplates;
g_Templates [],然後在兩個功能使用:
__control_entrypoint(DllExport) STDAPI DllGetClassObject(__in REFCLSID rClsID,
__in REFIID riid, __deref_out void **pv)
{
...
for (int i = 0; i < g_cTemplates; i++)
{
const CFactoryTemplate * pT = &g_Templates[i];
}
}
和
DllInitClasses(BOOL bLoading)
{
...
for (int i = 0; i < g_cTemplates; i++)
{
const CFactoryTemplate * pT = &g_Templates[i];
}
}
我檢查了所有的庫中的項目設置和一切似乎沒問題,使用64位版本。我應該怎麼做才能使項目爲x64平臺構建?
哪裏是定義(不聲明)的g_Templates?是否有可能從x64配置中忽略該文件? – dlf
要找到問題嘗試從行'extern CFactoryTemplate g_Templates [];' – KonstantinL