TheMadsen
TheMadsen

Reputation: 303

Error in premake generated linker command for (at least) visual studio 2010 express

There seems to be an error when generating VS2010 projects from premake, even with the "Hello World" example (Also tried with clink (here) and premake itself)

hello.c

#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" }

This simple example fails to link with the message "LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt"

The logfile says:

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

Upvotes: 1

Views: 516

Answers (1)

TheMadsen
TheMadsen

Reputation: 303

SOLVED!! It was an error in my pristine VS2010 install!! See

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

Although i never installed anything but VS2010 ..

SOLUTION: From this page: http://blogs.msdn.com/b/heaths/archive/2011/04/01/visual-c-2010-sp1-compiler-update-for-the-windows-sdk-7-1.aspx

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

into Programs(x86)\Microsoft Visual Studio 10.0\VC\Bin\

Upvotes: 1

Related Questions