----- Original Message ----- From: "John Peacock" <[EMAIL PROTECTED]> . . > > http://rt.cpan.org/Ticket/Display.html?id=20752 > > It appears that I need to use more than just $Config{cc} with VC++, because the > damn thing wants to *link* the code too. I see that ExtUtils::CBuilder uses all > of the various $Config{cc*flags} when it implements compile(). Anyone know > which one under VC++ has '/c', so I don't have to recreate ExtUtils::CBuilder > inside my Makefile.PL??? I'd rather not use a platform-dependent bit here, but > I will if I have to... :( >
I don't think there is a %Config key that contains the compile-only switch. However, there is a fairly simple solution to your problem. The problem is not so much that 'cl' wants to link as well as compile. It's just that 'cl', in creating the executable (test.obj) needs to first create an object file with exactly the same name ... and that's what it's complaining about. The solution, I believe, is to simply specify a name other than 'test' for the object file: system( "$Config{cc} -o mytest$Config{obj_ext} test.c" ) and return 0; Works for me, anyway, on Win32 with VC++, and shouldn't bother any other OS, should it ? With VC++, however, you'll end up with an object file named 'test.obj' as well as an executable named 'mytest.obj', so you might want to unlink 'test.obj' when it exists: map { unlink $_ if -f $_ } ('test.c',"mytest$Config{obj_ext}", "test$Config{obj_ext}"); I've tested the above changes on Win32 with both VC-built (cl compiler) perl and MinGW-built (gcc compiler) perl. Cheers, Rob