安裝Visual Studio 2012發行預覽版後出現錯誤“ LINK:致命錯誤LNK1123:轉換爲COFF期間失敗:文件無效或損壞”

本文翻譯自:Error 'LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt' after installing Visual Studio 2012 Release Preview

I've installed Visual Studio 2012 Release Preview, and it appears to be fine, but now when I try to use Visual Studio 2010 to compile C++ projects, I get the following error message: 我已經安裝了Visual Studio 2012 Release Preview,它看起來還不錯,但是現在當我嘗試使用Visual Studio 2010編譯C ++項目時,出現以下錯誤消息:

LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt 鏈接:致命錯誤LNK1123:轉換爲COFF期間失敗:文件無效或損壞

I'm not 100% sure of this, but it seems to be related to projects that have .rc (resource) files in them. 我不太確定這一點,但似乎與其中具有.rc (資源)文件的項目有關。

I've tried repairing Visual Studio 2010 from Add/Remove programs and rebooting, but this has no effect. 我嘗試過從“添加/刪除程序”修復Visual Studio 2010並重新啓動,但這無效。

I also get the same error if I use Visual Studio 2012 RC to compile the C++ projects when set to use the Visual Studio 2010 toolset. 如果在設置爲使用Visual Studio 2010工具集時使用Visual Studio 2012 RC編譯C ++項目,也會遇到相同的錯誤。 Upgrading to the Visual Studio 2011 toolset fixes the problem (but of course I don't want to do this for production code). 升級到Visual Studio 2011工具集可以解決此問題(但是我當然不想在生產代碼中這樣做)。

Update: I've uninstalled Visual Studio 2012 , rebooted, and the problem still persists! 更新:我已經卸載了Visual Studio 2012 ,重新啓動後,問題仍然存在! Help! 救命!


#1樓

參考:https://stackoom.com/question/jgZD/安裝Visual-Studio-發行預覽版後出現錯誤-LINK-致命錯誤LNK-轉換爲COFF期間失敗-文件無效或損壞


#2樓

I solved this problem eventually by doing a full uninstall of VS2012 RC, followed by a full uninstall of VS2010, then a reinstall from scratch of VS2010. 我最終通過完全卸載VS2012 RC,然後完全卸載VS2010,然後從頭重新安裝VS2010,解決了此問題。

It took forever, but I'm now able to compile C++ projects in VS2010 again. 花了很長時間,但是現在我可以再次在VS2010中編譯C ++項目。


#3樓

This MSDN thread explains how to fix it. 此MSDN線程說明了如何修復它。

To summarize: 總結一下:

  • Either disable incremental linking, by going to 您可以通過以下方法禁用增量鏈接

     Project Properties -> Configuration Properties -> Linker (General) -> Enable Incremental Linking -> "No (/INCREMENTAL:NO)" 
  • or install VS2010 SP1. 或安裝VS2010 SP1。

Edits (@CraigRinger): Note that installing VS 2010 SP1 will remove the 64-bit compilers . 編輯(@CraigRinger):請注意,安裝VS 2010 SP1將刪除64位編譯器 You need to install the VS 2010 SP1 compiler pack to get them back. 您需要安裝VS 2010 SP1編譯器包才能將其恢復。

This affects Microsoft Windows SDK 7.1 for Windows 7 and .NET 4.0 as well as Visual Studio 2010 . 這會影響用於Windows 7和.NET 4.0的Microsoft Windows SDK 7.1以及Visual Studio 2010


#4樓

I tried a few times and finally solved the problem by uninstalling several times the VS2010. 我嘗試了幾次,最後通過多次卸載VS2010來解決了問題。 I think I hadn't uninstalled all the files and that's why it didn't work for the first time. 我想我還沒有卸載所有文件,這就是爲什麼它第一次不起作用。

In the installation of VS2012, it is said that if you have VS2010 SP1 you can't work on the same project in both programs. 據說在VS2012的安裝中,如果您擁有VS2010 SP1,則無法在兩個程序中同時處理同一項目。 It is recommended to have only one program. 建議只有一個程序。

Thanks! 謝謝!


#5樓

It's because of .NET Framework 4.5 is replacing .NET Framework 4.0. 這是因爲.NET Framework 4.5取代了.NET Framework 4.0。 I uninstalled Visual Studio 2010 several times with no luck. 我沒有好運幾次卸載了Visual Studio 2010。 When I removed .NET Framework 4.5 and reinstalled Visual Studio 2010 it went fine. 當我刪除.NET Framework 4.5並重新安裝Visual Studio 2010時,一切正常。

See Uninstall Visual Studio 11 completely to do a fresh install . 請參閱完全卸載Visual Studio 11進行全新安裝


#6樓

If you have installed Visual Studio 2012 RC, then it installed .NET 4.5 RC. 如果您已安裝Visual Studio 2012 RC,則它將安裝.NET 4.5 RC。

Uninstall .NET 4.5 RC, and install the version you need (4.0 for VS 2010). 卸載.NET 4.5 RC,然後安裝所需的版本(VS 2010爲4.0)。 This should clear up any problems you are having. 這樣可以清除您遇到的所有問題。

This solved the same problem. 這解決了同樣的問題。 There is no need to uninstall Visual Studio. 無需卸載Visual Studio。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章