in reply to Cannot compile Encode::Detect on Windows

Here is the solution. Note that I was building version 1.00 for various reasons but the same procedure should work for 1.01. I was using ActiveState 5.10.0 build 1004 and MSVC 2005 Pro.

Replace the Module::Build Makefile.PL with an EU::MM one:

#!/usr/bin/perl use strict; use ExtUtils::MakeMaker qw(WriteMakefile); my @INC = (' -Isrc -Iinclude'); WriteMakefile( NAME => 'Encode::Detect::Detector', VERSION_FROM => 'Detector.pm', PREREQ_PM => {}, ABSTRACT_FROM => 'Detector.pm', AUTHOR => '', INC => join(' ', @INC), C => [ glob 'src/*.cpp Detector.c' ], H => [ glob 'src/*.h' ], OBJECT => q/$(O_FILES)/, );
Run Makefile.PL with CC var to enable C++ mode:
$ perl Makefile.PL CC="cl -TP" $ nmake
This will fail because it's looking for *.obj files in the src directory but they were built in the main directory.
$ copy *.obj src $ nmake
This will compile everything, but not copy Encode/Detect.pm to the correct place.
$ copy Detect.pm blib\lib\Encode $ nmake test
Done! There is almost certainly a way within Makefile.PL to work around the last 2 issues, but I didn't want to spend any more time on it.