链接时报如下错误: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 */问题在哪里?
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 */问题在哪里?
加上相应的.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)
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 ;
}
我觉得可能是配置上的错误,就不知道问题在哪儿?另
new一个Win32 Application,选择A Simple Win32 Application ,WINMAIN()里就
一个 RETURN 0;