PJLMon won't build (LNK 2019)
===

I'm trying to compile the sample language monitor PJLMon, but a linker error is preventing the code from building successfully. I'd post the whole code, but it's a bit much (most of it probably irrelevant to the question at hand), and is easily found online.

The error in question is: "1>pjlmon.obj : error LNK2019: unresolved external symbol _SetPort referenced in function _ClearPrinterStatusAndIniJobs"

The code in question refers to that found in pjlmon.c, and is shown below:

    VOID
    ClearPrinterStatusAndIniJobs(
        __in    PINIPORT    pIniPort
        )
    {
        PORT_INFO_3 PortInfo3;
    
        if ( pIniPort->PrinterStatus ||
             (pIniPort->status & PP_PRINTER_OFFLINE) ) {
    
            pIniPort->PrinterStatus = 0;
            pIniPort->status &= ~PP_PRINTER_OFFLINE;
    
            ZeroMemory(&PortInfo3, sizeof(PortInfo3));
            SetPort(NULL, pIniPort->pszPortName, 3, (LPBYTE)&PortInfo3); // LNK2019 HERE
        }
    
        SendJobLastPageEjected(pIniPort, ALL_JOBS, FALSE);
    }

I have not modified the program logic in any way. I have modified some header files to be found locally (i.e. #include "winsplp.h" instead of <winsplp.h>), but these files are otherwise unchanged, so I don't think this is an issue. I'll go ahead and show my defines and includes anyway, though, just in case I made a silly mistake:

    #define USECOMM
    
    #include "precomp.h"
    #include "ntddpar.h"
    
    #include <windows.h>
    #undef SetPort
    
    #include <WinReg.h>
    #include <winioctl.h>

I have CLR turned off, and I'm not using precompiled headers.

Under Project->Properties->Linker->Input->Additional Dependencies, I added "winspool.lib; advAPI32.lib". These files should contain references to the functions in winspool.h (which is included automatically with windows.h) and winreg.h.

The #undef SetPort code removes a macro which is set to change "SetPort" to "SetPortW" (unicode) or "SetPortA" (ascii). I don't think this is a problem.

I'm a bit lost as to where to go from here. Any suggestions would be greatly appreciated!
