1

从 premake 生成 VS2010 项目时似乎出现错误,即使使用“Hello World”示例(也尝试使用 clink(here)和 premake 本身)

你好ç

#include <stdio.h>

int main(void) {
   puts("Hello, word!");
   return 0;
}

premake4.lua

-- premake4.lua
solution "HelloWorld"
   configurations "Any"
project "HelloWorld"
   kind "ConsoleApp"
   language "C"
   files "*.c"
   defines { "DEBUG" }
   flags { "Symbols" }

这个简单的示例无法链接到消息“LINK:致命错误 LNK1123:转换为 COFF 期间失败:文件无效或损坏”

日志文件说:

Build started 09-02-2015 16:06:34.
     1>Project "E:\D\Source\premake-dev\pm-test\HelloWorld.vcxproj" on node 2 (build target(s)).
     1>InitializeBuildStatus:
         Creating "obj\Any\HelloWorld.unsuccessfulbuild" because "AlwaysCreate" was specified.
       ClCompile:
         C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\CL.exe /c /ZI /nologo /W3 /WX- /Od /Oy- /D DEBUG /D _MBCS /Gm /EHsc /RTC1 /MDd /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Fo"obj\Any\\" /Fd".\HelloWorld.pdb" /Gd /TC /analyze- /errorReport:prompt hello.c
         hello.c
       ManifestResourceCompile:
         C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\bin\rc.exe /nologo /fo"obj\Any\HelloWorld.exe.embed.manifest.res" obj\Any\HelloWorld_manifest.rc 
       Link:
         C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:".\HelloWorld.exe" /INCREMENTAL /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /ManifestFile:"obj\Any\HelloWorld.exe.intermediate.manifest" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /DEBUG /PDB:"E:\D\Source\premake-dev\pm-test\HelloWorld.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /ENTRY:"mainCRTStartup" /DYNAMICBASE /NXCOMPAT /IMPLIB:".\HelloWorld.lib" /MACHINE:X86 obj\Any\HelloWorld.exe.embed.manifest.res
         obj\Any\hello.obj
     1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
     1>Done Building Project "E:\D\Source\premake-dev\pm-test\HelloWorld.vcxproj" (build target(s)) -- FAILED.

Build FAILED.

Time Elapsed 00:00:00.33
4

1 回答 1

1

解决了!!这是我原始 VS2010 安装中的错误!看

https://social.msdn.microsoft.com/Forums/vstudio/en-US/d10adba0-e082-494a-bb16-2bfc039faa80/vs2012-rc-installation-breaks-vs2010-c-projects?forum=vssetup

虽然除了VS2010我从来没有安装过任何东西..

解决方案:从此页面:http: //blogs.msdn.com/b/heaths/archive/2011/04/01/visual-c-2010-sp1-compiler-update-for-the-windows-sdk-7- 1.aspx

复制 c:\windows\Microsoft.Net\Framework\v4.0.30319\ cvtres.exe (42Kb)

进入 Programs(x86)\Microsoft Visual Studio 10.0\VC\Bin\

于 2015-02-11T17:46:21.360 回答