It's OK, I've sorted it now.
It seems to be a problem with the DirectX9 wizard. The wizard generated code assumes a UNICODE build, but the project build options are set to _MBCS. I changed all references to unicode text in the main.cpp file then got the original undefined reference error. I then noticed an error in the WinMain line:
Original line:
INT WINAPI wWinMain( HINSTANCE hInst, HINSTANCE, LPWSTR, INT ) <== used when building Unicode
New line:
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, INT ) <== used for MBCS
Now it builds/links and runs fine.