Problem concerns with network programming. 
Author Message
 Problem concerns with network programming.

Hi everyone,

  I have a question concerns about network programming.  I wrote a very
simple network program.  Although the compiling was ok, building was failed.
The error message is as following:

/*********************Error Message**************************/
Linking...
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
__endthreadex
nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
__beginthreadex
Debug/sockServer.exe : fatal error LNK1120: 2 unresolved externals
/**************************************************************/

My coding is as following:

/*******************coding********************/
#include <iostream.h>
#include <afxsock.h>
#define nPort 1999

int main()
{
 CSocket sockSrvr;
 CString strText="haha";

 if (sockSrvr.Create(nPort))
 {
  cout << "Socket created.\n";
 }
 else
 {
  cout << "Error: Socket cannot be created.\n";
  exit(1);
 }

 if (sockSrvr.Listen())
 {
  cout << "Socket is listening for connection.\n";
 }
 else
 {
  cout << "Error: socket is not able to listen.\n";
  exit(1);
 }

 CSocket sockRecv;

 if (sockSrvr.Accept( sockRecv ))
 {
  cout << "Connection is accepted.\n";
 }
 else
 {
  cout << "Connection is not accepted.\n";
  exit(1);
 }

 CSocketFile file(&sockRecv);
 CArchive arIn(&file, CArchive::load);
 CArchive arOut(&file, CArchive::store);

 arIn >> strText;
 arOut << strText;

 sockSrvr.Close();
 return 0;

Quote:
}



Sat, 09 Feb 2002 03:00:00 GMT  
 Problem concerns with network programming.
You need to be linking against the multithreaded libraries.  Add the /MT
switch to your compiler options.

Quote:
> Hi everyone,

>   I have a question concerns about network programming.  I wrote a very
> simple network program.  Although the compiling was ok, building was
failed.
> The error message is as following:

> /*********************Error Message**************************/
> Linking...
> nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
> __endthreadex
> nafxcwd.lib(thrdcore.obj) : error LNK2001: unresolved external symbol
> __beginthreadex
> Debug/sockServer.exe : fatal error LNK1120: 2 unresolved externals
> /**************************************************************/

> My coding is as following:

> /*******************coding********************/
> #include <iostream.h>
> #include <afxsock.h>
> #define nPort 1999

> int main()
> {
>  CSocket sockSrvr;
>  CString strText="haha";

>  if (sockSrvr.Create(nPort))
>  {
>   cout << "Socket created.\n";
>  }
>  else
>  {
>   cout << "Error: Socket cannot be created.\n";
>   exit(1);
>  }

>  if (sockSrvr.Listen())
>  {
>   cout << "Socket is listening for connection.\n";
>  }
>  else
>  {
>   cout << "Error: socket is not able to listen.\n";
>   exit(1);
>  }

>  CSocket sockRecv;

>  if (sockSrvr.Accept( sockRecv ))
>  {
>   cout << "Connection is accepted.\n";
>  }
>  else
>  {
>   cout << "Connection is not accepted.\n";
>   exit(1);
>  }

>  CSocketFile file(&sockRecv);
>  CArchive arIn(&file, CArchive::load);
>  CArchive arOut(&file, CArchive::store);

>  arIn >> strText;
>  arOut << strText;

>  sockSrvr.Close();
>  return 0;
> }



Sat, 09 Feb 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. socket programming problem (network not reachable)

2. socket programming problem (network not reachable)

3. Problems initiating network programming

4. help - concerning leap year program

5. Program from "Unix Network Programming"

6. Problem concerning srand() function ?

7. Problem concerning CRecordset, ODBC, Time consumption, Threads locked

8. Problem possibly concerning Dll and IExplore browser

9. "Problem concerning with 'make' output

10. Problem concerning CRecordset, ODBC, Time consumption, Threads locked

11. Urgent: a long unsolved problem concerned with resource

12. Creating a network usage and monitor program

 

 
Powered by phpBB® Forum Software