我正在尝试将一个旧的32位应用程序编译为64位。
我重新编译了所有使用的库,并让它查找WIN SDK6.0A x64位库。
我使用的工具和环境如下:
- Visual Studio 2008专业版
- Visual C++
- dotNet Framework 3.5 SP1
- Windows Server 2008 R2
- Windows SDK版本为6.0A
虽然一切看起来都正常,但我却遇到了奇怪的未定义符号错误:
error LNK2019: unresolved external symbol InterlockedDecrement referenced in function ...
error LNK2019: unresolved external symbol InterlockedIncrement referenced in function ...
error LNK2019: unresolved external symbol GetModuleBaseName referenced in ...
error LNK2019: unresolved external symbol EnumProcessModules referenced in ...
error LNK2019: unresolved external symbol EnumProcesses referenced in ...
error LNK2019: unresolved external symbol GetProcessMemoryInfo referenced
问题是这些都是来自SDK的win stuff。
InterlockedDec和InterlockedInc来自kernel32.lib。
GetModuleBaseName、EnumProcessModules、EnumProcesses、GetProcessMemoryInfo在psapi.h中,但也可以在kernel32.lib或psapi.lib中找到。我检查了C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64,两个库kernel32.lib和psapi.lib都在那里。
它肯定在正确的位置查找库。我打开了/VERBOSE:LIB,它指向了正确的文件夹。
所以我真的很困惑为什么它没有找到它们。
有任何想法吗?
谢谢
#pragma comment(lib, "psapi.lib")
来添加该库。 - Billy ONeal