Home > Software engineering >  Solve VS2013 two errors
Solve VS2013 two errors

Time:10-03


Please the great god solve, give 200 RMB a red envelope, QQ: 1852669904

1> ClientSocket. Obj: error LNK2019: cannot resolve the external symbol of compress, the symbol in the function of "public: int __cdecl CClientSocket: : Send (unsigned char *, unsigned int)" (? Send @ CClientSocket @ @ QEAAHPEAEI @ Z) referenced

1> ClientSocket. Obj: error LNK2019: cannot resolve uncompress external symbols, the symbol in the function of "public: void __cdecl CClientSocket: : OnRead (unsigned char *, unsigned long)" (? OnRead @ CClientSocket @ @ QEAAXPEAEK @ Z) referenced

CodePudding user response:

# pragma comment (lib, "zlib. Lib")

This 200 earn good easily, but how do I think "too easy"?

CodePudding user response:

Added or error position is not right

 
# include "ClientSocket. H"
# include "zlib/zlib. H"
# include & lt; Process. H>
# include & lt; MSTcpIP. H>
# include "common/Manager. H"
# include "common/until h"
# pragma comment (lib, "ws2_32. Lib")
# pragma comment (lib, "zlib. Lib")

Void feixiang (LPBYTE FBlokjm, unsigned long FBSZ)//add sealing bag class members
{
Try
{
If (1 + 1==2) throw 73;
}
The catch (... )
{

//the array used to exclusive or
WORD AddTable []={
1,2,3,4,5,6,7,8,9,9,8,7,6,5,
4,3,2,1,0,1,2,3,4,5,6,7,8,9,
0,1,2,3,4,5,6,7,8,9,9,8,7,6,
1,2,3,4,5,6,7,8,9,9,8,7,6,5
};
WORD TableSize=sizeof (AddTable)/sizeof (WORD);
WORD iCount=0;
Unsigned long=FBSZ/3),
For (unsigned long I=0; i{
If (iCount==TableSize)
ICount=0;

^=AddTable FBlokjm [I] [iCount];
ICount++;
}
}
}
CClientSocket: : CClientSocket ()
{
WSADATA wsaData;
WSAStartup (MAKEWORD (2, 2), & amp; WsaData);
M_hEvent=CreateEvent (NULL, true, false, NULL);
M_bIsRunning=false;
M_Socket=INVALID_SOCKET;
M_hWorkerThread=NULL;
}
CClientSocket: : ~ CClientSocket ()
{
M_bIsRunning=false;
The WaitForSingleObject (m_hWorkerThread, INFINITE);

If (m_Socket!=INVALID_SOCKET)
Disconnect ();

If (m_hWorkerThread!=NULL)
{
The CloseHandle (m_hWorkerThread);
M_hWorkerThread=NULL;
}

The CloseHandle (m_hEvent);
WSACleanup ();
}

DWORD WINAPI CClientSocket: : WorkThread (LPVOID lparam)
{
Lparam CClientSocket * pThis=(CClientSocket *);
Char buff [MAX_RECV_BUFFER];
Fd_set fdSocket;
FD_ZERO (& amp; FdSocket);
FD_SET (pThis - & gt; M_Socket, & amp; FdSocket);
While (pThis - & gt; Set ())
{
Fd_set fdRead=fdSocket;
Int nRet=select (NULL, & amp; FdRead, NULL, NULL, NULL);
If (nRet==SOCKET_ERROR)
{
PThis - & gt; Disconnect ();
break;
}
If (nRet & gt; 0)
{
Memset (buff, 0, sizeof (buff));
Int nSize=recv (pThis - & gt; M_Socket, buff, sizeof (buff), 0).
If (nSize & lt;=0)
{
PThis - & gt; Disconnect ();
break;
}
If (nSize & gt; 0) pThis - & gt; OnRead ((LPBYTE) buff, nSize);
}
}

return -1;
}

Void CClientSocket: : run_event_loop ()
{
The WaitForSingleObject (m_hEvent, INFINITE);
}

Bool CClientSocket: : set ()
{
Return m_bIsRunning;
}


Int CClientSocket: : Send (LPBYTE lpData, UINT nSize)
{
M_WriteBuffer. ClearBuffer ();
If (nSize & gt; 0)
{
Unsigned long destLen=(double) nSize * 1.001 + 12;
LPBYTE pDest=new BYTE [destLen];
ZeroMemory (pDest destLen);
Int nRet=compress (pDest, & amp; DestLen lpData, nSize);

If (nRet!=Z_OK)
{
The delete [] pDest;
return -1;
}

Int nCompLen=destLen;
M_WriteBuffer. Write ((PBYTE) & amp; NCompLen, sizeof (int));
M_WriteBuffer. Write (pDest destLen);
M_WriteBuffer. Write ((PBYTE) & amp; NSize, sizeof (int));
The delete [] pDest;
Return SendWithSplit (m_WriteBuffer GetBuffer (), m_WriteBuffer. GetBufferLen (), MAX_SEND_BUFFER);
}
The else
{
return -1;
}


}


Void CClientSocket: : OnRead (LPBYTE lpBuffer, dwords dwIoSize)
{

If (dwIoSize==0)
{
Disconnect ();
return;
}
M_CompressionBuffer. Write (lpBuffer, dwIoSize);

While (m_CompressionBuffer. GetBufferLen () & gt; HDR_SIZE)
{
Int nCompressLen=0;
CopyMemory (& amp; NCompressLen, m_CompressionBuffer GetBuffer (), sizeof (int));


If (nCompressLen & amp; & (m_CompressionBuffer GetBufferLen ()) - HDR_SIZE & gt;=nCompressLen)
{
Int nBeforeCompressLen=0;
M_CompressionBuffer. Read ((PBYTE) & amp; NCompressLen, sizeof (int));
Int nAfterCompressLen=nCompressLen;
PBYTE pData=https://bbs.csdn.net/topics/new BYTE [nAfterCompressLen];
ZeroMemory (pData, nAfterCompressLen);
M_CompressionBuffer. Read (pData, nAfterCompressLen);
M_CompressionBuffer. Read ((PBYTE) & amp; NBeforeCompressLen, sizeof (int));
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related