You seem to be using some very outdated example code - NS_NewGenericModule2
has been removed from the Firefox codebase in Firefox 4, along with major XPCOM changes. I'm not sure how you managed to compile you code and why the issue only comes up when linking - normally (when using a current XULRunner SDK release) you should get an error already during compilation.
As to current example code, there is one in the Firefox code base. Have a look at nsSampleModule.cpp
for a module definition example, nsSample.cpp
contains the actual XPCOM object implementation.