本文介绍了在Windows 64中编译32位应用程序时未解析的外部符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我试图编译遗留的应用程序从32位到64位..
我重新编译了所有的libs它使用,并查找WIN SDK6.0A x64位为libs ..

我使用的是:




  • Visual Studio Professional Edition 2008

  • Visual C ++

  • dotNet Framework 3.5 SP1

  • Windows Server 2008R2

  • 6.0A



Everythings终于来了,但我得到了这些奇怪的未定义的符号错误:




错误LNK2019:未解析的外部符号在函数...中引用的InterlockedDecrement
错误LNK2019:未解析的外部符号在函数...中引用的InterlockedIncrement
错误LNK2019:未解析的外部符号GetModuleBaseName在...中引用
错误LNK2019:未解析的外部符号EnumProcessModules在...中引用
错误LNK2019:未解析的外部符号在...中引用的EnumProcesses
错误LNK2019:未解析的外部符号GetProcessMemoryInfo引用

问题是这些都是来自SDK的win东西。
InterlockedDec和InterlockedInc来自kernel32.lib
GetModuleBaseName,EnumProcessModules,EnumProcesses,GetProcessMemoryInfo在psapi.h中,还有kernel32.lib或psapi.lib



我检查过C:\Program Files \Microsoft SDKs \Windows \v6.0A\Lib\x64和libs
kernel32.lib和psapi.lib。



它肯定是在正确的位置查找libs。我打开/ VERBOSE:LIB
,它指向正确的文件夹。



所以我真的很困惑为什么它找不到它们。 b
$ b

任何想法



感谢

解决方案

所以我终于搞清楚了,kinda ...
它找不到psapi.lib



在Project-> Linker->依赖而不是只是说psapi.lib
我给了完整的路径,它工作...
不是真的确定为什么它没有找到它之前,但很好...


So I am trying to compile legacy app from 32 bit to 64 bit..I re-compiled all of the libs it used and made it look into WIN SDK6.0A x64 bit for libs..

I am using:

  • Visual Studio Professional Edition 2008
  • Visual C++
  • dotNet Framework 3.5 SP1
  • Windows Server 2008R2
  • Windows SDK is 6.0A

Everythings finally coming up but I am getting these weird undefined symbol errors:

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 

The problem is these are all win stuff from SDK.InterlockedDec and InterlockedInc are coming from kernel32.libGetModuleBaseName, EnumProcessModules, EnumProcesses,GetProcessMemoryInfo are in psapi.h but also kernel32.lib or psapi.lib

I checked C:\Program Files\Microsoft SDKs\Windows\v6.0A\Lib\x64 and both libskernel32.lib and psapi.lib are there.

It definitely looks up the libs at right spot. I turned on /VERBOSE:LIB and it points to the correct folder.

So I am really confused why isnt it finding them.

Any ideas???

Thanks

解决方案

So I finally figured it out, kinda...It wasnt finding psapi.lib

In Project->Linker->Additional dependencies instead of just saying psapi.libI gave full path to it and it worked...not really sure why it failed to find it before but oh well...

这篇关于在Windows 64中编译32位应用程序时未解析的外部符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 15:57