Visual Studio错误:LNK1104:无法打开文件'kernel32.lib' - 只在WP8项目/ Win32版本 [英] Visual Studio error: LNK1104: cannot open file 'kernel32.lib' - only in WP8 projects / Win32 builds

查看:884
本文介绍了Visual Studio错误:LNK1104:无法打开文件'kernel32.lib' - 只在WP8项目/ Win32版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近遇到这个问题(几天前一切工作正常):Visual Studio 2012开始拒绝构建原生WP8项目。



今天,我创建新的解决方案从模板Windows Phone Direct3D应用程序(仅本机),以检查我的新创建的DLL是否将正确支持WP。我试图编译这个项目,首先没有任何更改或额外的引用 - VS生成的纯代码。但是,它失败了给定的错误。
我知道这是什么意思,什么可能是可能的原因,但我不能理解,hovewer,它在哪里来自这种情况。
奇怪的事情:这只发生在Win32配置中,ARM编译得很好:

  1& - 构建开始:项目:PhoneDirect3DApp,配置:调试ARM ------ 
.......

构建摘要
------ -------
00:11.742 - Success - Debug ARM - PhoneDirect3DApp\PhoneDirect3DApp.vcxproj

但Win32不能:

  1> ------ Build started:Project:PhoneDirect3DApp,Configuration :Debug Win32 ------ 
.......
1> LINK:致命错误LNK1104:无法打开文件'kernel32.lib'

构建摘要
-------------
00:09.725 - 失败 - 调试Win32 - PhoneDirect3DApp\PhoneDirect3DApp.vcxproj

我的标准(本地C ++ / Win32)项目也可以按预期工作(在Win32和x64平台目标中)。



项目配置:(在两个平台中)



链接器::输入:

 code> d3d11.lib;%(AdditionalDependencies)

Linker :: Ignore:

  ole32.lib;%(IgnoreSpecificDefaultLibraries)

VC ++目录:



Microsoft.ARM.Cpp.User:

  $(WP80ToolSetPath)lib\arm; $(WindowsSDK_LibraryPath_ARM); 

Microsoft.Win32.Cpp.User:

  $(VCInstallDir)lib; $(VCInstallDir)atlmfc\lib; $(WP80ToolSetPath)lib\x86; $(WindowsSDK_LibraryPath_x86)

任何想法还有什么可能是错误的或配置不正确?我没有想法,我从来没有见过这样的事情。



顺便说一句,我注意到一个更改:当我试图编译WP8项目在ARM配置之前,总是有一个错误,说在桌面上构建ARM应用程序不支持(或类似的东西)。现在ARM编译没有问题。是否正常?

解决方案

最后,我发现了我的问题的原因:



我做了所有标准步骤,但在LNK1104的情况下可以执行:

 
- kernel32.lib位于有效位置
- 所有include和库目录都正确
- standard * .props文件附加到每个项目


所有路径都是使用标准宏定义的。其中之一是$(WindowsSDK80Path),用于构建include / library路径。在我的系统上,此宏定义为

  C:\Program Files(x86)\Windows Phone Kits\8.0 

而不是

  C:\Program Files(x86)\Windows Kits\8.0 

就是这样。我不知道,什么时候或如何,这个问题烦恼。 Visual Studio修复通过orginal安装程序是足够的方法来修复一切。所有项目现在编译没有任何问题。


I ran into this problem recently (few days ago everything was working fine): Visual Studio 2012 started to refuse to build native WP8 projects.

Today, I created new solution from template 'Windows Phone Direct3D App (Native Only)' to check if my newly created DLLs will be properly supported on WP. I tried to compile this project, first without any changes or additional references - pure code generated by VS. However, it failed with given error. I know very well what does it mean and what could be the possible reason, but I can't understand, hovewer, where does it come from in this case. Weird thing: this only happens in 'Win32' configuration, ARM compiles fine:

1>------ Build started: Project: PhoneDirect3DApp, Configuration: Debug ARM ------
.......

Build Summary
-------------
00:11.742 - Success - Debug ARM - PhoneDirect3DApp\PhoneDirect3DApp.vcxproj

but Win32 does not:

1>------ Build started: Project: PhoneDirect3DApp, Configuration: Debug Win32 ------
.......
1>LINK : fatal error LNK1104: cannot open file 'kernel32.lib'

Build Summary
-------------
00:09.725 - Failed  - Debug Win32 - PhoneDirect3DApp\PhoneDirect3DApp.vcxproj

My standard (native C++/Win32) projects also work as expected (in both Win32 and x64 platform targets).

Project configuration: (in both platforms)

Linker::Input:

d3d11.lib;%(AdditionalDependencies)

Linker::Ignore:

ole32.lib;%(IgnoreSpecificDefaultLibraries)

VC++ Directories:

Microsoft.ARM.Cpp.User:

$(WP80ToolSetPath)lib\arm;$(WindowsSDK_LibraryPath_ARM);

Microsoft.Win32.Cpp.User:

$(VCInstallDir)lib;$(VCInstallDir)atlmfc\lib;$(WP80ToolSetPath)lib\x86;$(WindowsSDK_LibraryPath_x86)

Any ideas what else could be wrong or configured incorrectly? I'm running out of ideas, I have never seen something like this before.

By the way, I have noticed one more change: when I was trying to compile WP8 projects in ARM configurtion before, there was always an error, saying "building ARM application on desktop is not supported" (or something like that). Now ARM compiles with no problem. Is it normal?

解决方案

Finally, I have found the reason of my problems: as I suspected, internal Visual Studio configuration has been broken.

I did all standard steps, that can be performed in case of LNK1104, however:

- kernel32.lib was in valid location
- all include and library directories was correct
- standard *.props files were attached to each project

However, the cause was lying elsewhere.

All paths are defined using standard macros. One of them is $(WindowsSDK80Path), which is used to build include/library paths. On my system, this macro was defined as

C:\Program Files (x86)\Windows Phone Kits\8.0

instead of

C:\Program Files (x86)\Windows Kits\8.0

And that's it. I do not know, when or how, this problem arosed. Visual Studio repair via orginal installer was sufficient method to fix everything. All projects compile now without any problems.

这篇关于Visual Studio错误:LNK1104:无法打开文件'kernel32.lib' - 只在WP8项目/ Win32版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆