I am trying to compile a gtk example w/ the latest stable release (haven't tried master yet) using vcc with the following command:
nimrod compile --cincludes:C:\PROGRA~1\MICROS~2.0\VC\INCLUDE --cincludes:C:\PROGRA~1\MI2578~1\WINDOWS\V7.0A\INCLUDE --clibdir:C:\PROGRA~1\MICROS~2.0\VC\LIB --clibdir:C:\PROGRA~1\MI2578~1\WINDOWS\V7.0A\LIB ex2.nim
I get this towards the end:
cl.exe /DEBUG /Zi /Fd"$projectName.pdb" /F33554432 /LIBPATH:C:\PROGRA~1\MICROS~2.0\VC\LIB /LIBPATH:C:\PROGRA~1\MI2578~1\WINDOWS\V7.0A\LIB /Fec:\work\nimrod-play\gtk2\examples\ex2.exe c:\work\nimrod-play\gtk2\examples\nimcache\gdk2.obj c:\work\nimrod-play\gtk2\examples\nimcache\gdk2pixbuf.obj c:\work\nimrod-play\gtk2\examples\nimcache\pango.obj c:\work\nimrod-play\gtk2\examples\nimcache\atk.obj c:\work\nimrod-play\gtk2\examples\nimcache\gtk2.obj c:\work\nimrod-play\gtk2\examples\nimcache\glib2.obj c:\work\nimrod-play\gtk2\examples\nimcache\system.obj c:\work\nimrod-play\gtk2\examples\nimcache\ex2.obj
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
cl : Command line warning D9002 : ignoring unknown option '/LIBPATH:C:\PROGRA~1\MICROS~2.0\VC\LIB'
cl : Command line warning D9002 : ignoring unknown option '/LIBPATH:C:\PROGRA~1\MI2578~1\WINDOWS\V7.0A\LIB'
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
/debug
/stack:33554432
/out:c:\work\nimrod-play\gtk2\examples\ex2.exe
c:\work\nimrod-play\gtk2\examples\nimcache\gdk2.obj
c:\work\nimrod-play\gtk2\examples\nimcache\gdk2pixbuf.obj
c:\work\nimrod-play\gtk2\examples\nimcache\pango.obj
c:\work\nimrod-play\gtk2\examples\nimcache\atk.obj
c:\work\nimrod-play\gtk2\examples\nimcache\gtk2.obj
c:\work\nimrod-play\gtk2\examples\nimcache\glib2.obj
c:\work\nimrod-play\gtk2\examples\nimcache\system.obj
c:\work\nimrod-play\gtk2\examples\nimcache\ex2.obj
LINK : fatal error LNK1104: cannot open file 'LIBCMT.lib'
Error: execution of an external program failed
I am using the Visual Studio 10.0 compiler. I believe the command should be:
cl.exe /DEBUG /Zi /Fd"$projectName.pdb" /F33554432 /Fec:\work\nimrod-play\gtk2\examples\ex2.exe c:\work\nimrod-play\gtk2\examples\nimcache\gdk2.obj c:\work\nimrod-play\gtk2\examples\nimcache\gdk2pixbuf.obj c:\work\nimrod-play\gtk2\examples\nimcache\pango.obj c:\work\nimrod-play\gtk2\examples\nimcache\atk.obj c:\work\nimrod-play\gtk2\examples\nimcache\gtk2.obj c:\work\nimrod-play\gtk2\examples\nimcache\glib2.obj c:\work\nimrod-play\gtk2\examples\nimcache\system.obj c:\work\nimrod-play\gtk2\examples\nimcache\ex2.obj /link /LIBPATH:C:\PROGRA~1\MICROS~2.0\VC\LIB /LIBPATH:C:\PROGRA~1\MI2578~1\WINDOWS\V7.0A\LIB
Note the linker values at the end. Am I doing something wrong or has this already been fixed in master? Figured I'd ask here before submitting a bug.
I have used that too but those options also put the linker options BEFORE the obj files in the CL commands. The Microsoft reference for the cl.exe tool (http://msdn.microsoft.com/en-us/library/610ecb4h.aspx) shows that options passed to the linker must come at the end and be prefixed with /link.
Looking at the nimrod code, it would be a very Windows specific change for ALL linker options to go at the end (especially since some of them in the default config are for cl.exe and not passed to link.exe). I was just mentioning that these arguments to the nimrod compiler do not work as is w/ vcc because they are not put in the right spot and are not prefixed with /link.