#include "myclass.h" using namespace std; MyClass::MyClass (int length, int width) { this->length = length; this->width = width; } int MyClass::area() { return this->length*this->width; } Makefile.PL This I basically took from the Tutorial mentioned in the Into, and adjusted it to my changes. use ExtUtils::MakeMaker; my ( $CC, $Verbose ) = ( 'g++', 1 ); WriteMakefile( NAME => 'Mytest::myclass', SKIP => [qw(all static static_lib dynamic dynamic_lib)], clean => {'FILES' => 'libmyclass$(LIB_EXT) unitTest'}, CC => $CC, # Our CPP compiler LD => '$(CC)', CCFLAGS => '-fPIC', # this instructs the CPP compiler to use "Position independence", basically a shared library, more details here # http://www.fpx.de/fp/Software/tcl-c++/tc+l-c++.html ); sub MY::top_targets { ' all :: static pure_all :: static static :: libmyclass$(LIB_EXT) libmyclass$(LIB_EXT): $(O_FILES) $(AR) cr libmyclass$(LIB_EXT) $(O_FILES) $(RANLIB) libmyclass$(LIB_EXT) bin: $(O_FILES) $(LD) $(O_FILES) -o unitTest '; }