链接时报如下错误:Linking...
commport.obj : error LNK2001: unresolved external symbol _sio_AbortWrite@4
commport.obj : error LNK2001: unresolved external symbol _sio_AbortRead@4
commport.obj : error LNK2001: unresolved external symbol _sio_RTS@8
commport.obj : error LNK2001: unresolved external symbol _sio_close@4
commport.obj : error LNK2001: unresolved external symbol _sio_ioctl@12
commport.obj : error LNK2001: unresolved external symbol _sio_open@4在commport.cpp里有对 sio_AbortWrite 的引用。在头文件里 对他们定义如下:
#define SIO_OK 0
#define SIO_BADPORT -1 /* no such port or port not opened */
#define SIO_OUTCONTROL -2 /* can't control the board */
#define SIO_NODATA -4 /* no data to read or no buffer to write */
#define SIO_OPENFAIL -5 /* no such port or port has be opened */
#define SIO_RTS_BY_HW -6      /* RTS can't set because H/W flowctrl */
#define SIO_BADPARM -7 /* bad parameter */
#define SIO_WIN32FAIL -8 /* call win32 function fail, please call */
/* GetLastError to get the error code */
#define SIO_BOARDNOTSUPPORT -9 /* Does not support this board */
#define SIO_FAIL -10 /* PComm function run result fail */
#define SIO_ABORTWRITE -11 /* write has blocked, and user abort write */
#define SIO_WRITETIMEOUT    -12 /* write timeoue has happened */问题在哪里?

解决方案 »

  1.   

    project--setting--link--Object/library modules里加上相应的.lib
      

  2.   

    你没加载相应的.lib文件,或者函数的.cpp文件没有被你添加到当前工程
      

  3.   


    加上相应的.lib后可以了,但还有如下两个错误:Linking...
    LIBCD.LIB(crt0.obj) : error LNK2001: unresolved external symbol _main
    Debug/a.exe : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.a.exe - 2 error(s), 0 warning(s)
      

  4.   

    你的工程的建立方式不对,最好用Win32 Console Application,建立一个"Hello World!"Application,之后把main的代码替换掉
      

  5.   

    此程序 NOT USING MFC,是一个WIN32 APP,WINMAIN 代码如下:int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
                         LPSTR     lpCmdLine, int nCmdShow )
    {
      int i;
    MSG msg; MyRegisterClass( hInstance ); if (!InitInstance (hInstance, nCmdShow)) 
    {
    return FALSE;
    } hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_FEND);
    GetLocalTime( &StartTime );
      GetCurrentDir( );
    InitHostWSAStartup( ); DisplayType = DISP_PORT_STATUS;
     
    WriteHostTimerCnt = 0;
        PortStatusTimerCnt = 0;
        RefreshTimerCnt = 0; ReadAllDDEPararm( );
        OpenPort( );
        
        WriteFendLog( TRUE );    nTimerId = SetTimer( hwnd, ID_TIMER, TIMERDURATION, NULL );    while( TRUE )
        {
    if( GetMessage( &msg, hwnd, 0, 0 ) )
            {
    if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) 
    {
    if( msg.message == WM_QUIT )
          break;
    TranslateMessage( &msg );
       DispatchMessage( &msg );
    }
            }
    if ( QuitFlag )
    break;
    } DestroyAcceleratorTable( hAccelTable );
     
    WriteProvRawValue( );
    WritePortTempData( );    ClosePort( );
        CloseHost( );
        CloseMmi( );
    UdpPingClose( ); WriteAllTrapFileBuf( ); KillTimer( hwnd, nTimerId );    WriteFendLog( FALSE );    for( i = 0; i < 5; i++ )
    MessageBeep( 0 );    return  msg.wParam  ;
    }
      

  6.   

    那你就new一个Win32 Application,选择A Simple Win32 Application,然后拷贝到相应的WinMain函数中
      

  7.   

    以上是我的WINMAIN()代码,您看应再修改什么?
    我觉得可能是配置上的错误,就不知道问题在哪儿?另
    new一个Win32 Application,选择A Simple Win32 Application  ,WINMAIN()里就
    一个 RETURN 0;