Unix-to-Windows, still unresolved external errors 
Author Message
 Unix-to-Windows, still unresolved external errors

I have tried removing the references to errno and the call to the MsgBox
function from the Unix side code.  In doing this I also removed the #include
errno.h and #include MsgBox.h (MsgBox.cpp has only the code for creating a
MessageBox in it, displaying whatever is passed to it, generally the text of
the last error).  What is interesting is that without even having errno in
the file or trying to fill it, I still get the exact same unresolved
external errors as before!  Doesn't make a lot of sense.

One example of when errno is used is:

      Result = recv (FD, (char *)Buffer + *Bytes_Read,
                     Number_Of_Bytes - *Bytes_Read,0);
      if (Result > 0)                   /* read data */
      {
         *Bytes_Read += Result;
      }
      else if (Result == 0)             /* EOF - connection closed */
      {
         return COMMON_API_ERROR;
      }
      else if (WSAGetLastError() == WSAEWOULDBLOCK ||  /* nothing there */
               errno == EAGAIN )
      {
          break;
      }
      else if (WSAGetLastError() == WSAEINTR)          /* interrupted - try
again */
      {
    continue;
      }
      else                              /* error */
      {
         return COMMON_API_ERROR;
      }

    In a case like this, reading from the socket, WSAGetLastError() gets the
last error and errno is set on an error in the call to recv from the socket,
correct?

    Also, when I commented out the (else if)errno == EAGAIN and the
#include, it made no difference, I still got the errors.

    There are mostly Unix people that I work with, few on the PC side.  One
of the people that I talked with noticed that I didn't have the #include
<errno.h> or the #include <stdlib.h> in my main program.  Thinking about
what they said, it made sense that this could be the problem, even though
the the header files are included where they are called.  The link order
would matter with VC++ 6.0.  However, why MsgBox isn't working is a mystery.
#including didn't help though.  Again, the errors I get are as follows:

--------------------Configuration: winspeak - Win32
Debug--------------------
Linking...
LC.lib(Common_API.obj) : error LNK2001: unresolved external symbol _errno
LC.lib(Socket_Peek.obj) : error LNK2001: unresolved external symbol _errno
LC.lib(Common_API.obj) : error LNK2001: unresolved external symbol _MsgBox
LC.lib(Socket_Peek.obj) : error LNK2001: unresolved external symbol _MsgBox
LC.lib(Socket_Peek.obj) : error LNK2001: unresolved external symbol __pctype
LC.lib(Socket_Peek.obj) : error LNK2001: unresolved external symbol
___mb_cur_max
Debug/winspeak.exe : fatal error LNK1120: 4 unresolved externals
Error executing link.exe.

winspeak.exe - 7 error(s), 0 warning(s)

Any further suggestions?

    Thanks,
            Scott


Quote:
> try replacing references to errno with WSAGetLastError(), it may
> eliminate one link error.

> I am not sure about the others. will get back to you when i am.

and


Quote:
> For _errno and __pctype, you may need to link in 'oldnames.lib' from
> the VC98\Lib directory.  Your MsgBox symbol I'm not familiar with - I'd
> guess that may be something that is / needs to be defined by the code
> from the Unix side developers.

> --
> -- Chase Vogelsberg, Senior Principal Analyst
> -- Logicon Information Systems & Services
> -- Wormwood and wine, and the bitter taste of ashes.



Wed, 26 Feb 2003 02:30:38 GMT  
 Unix-to-Windows, still unresolved external errors

Quote:

> I have tried removing the references to errno and the call to the MsgBox
> function from the Unix side code.  In doing this I also removed the #include
> errno.h and #include MsgBox.h (MsgBox.cpp has only the code for creating a
> MessageBox in it, displaying whatever is passed to it, generally the text of
> the last error).  What is interesting is that without even having errno in
> the file or trying to fill it, I still get the exact same unresolved
> external errors as before!  Doesn't make a lot of sense.
> ...

It makes more sense if you understand that h files are not directly related to
unresolved external errors.  The meaning of "unresolved" is that your code is
compiled to access something and then the linker finds when it puts all the
pieces together that the something is missing.  Something in your program
accesses _errno and there is no _errno in the program!  

Declaring what _errno is in an h file does *not* put one in the program, it only
tells the compiler what kind of thing it is.

--
Scott McPhillips [VC++ MVP]



Wed, 26 Feb 2003 10:23:07 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Unix-to-Windows code converted, now unresolved external errors

2. I need help with C/C++ on UNIX, and unresolved externals

3. PxSQLScript.obj : error LNK2001: unresolved external symbol "class ATL::CTraceCa

4. VC++ 7 Link Error : unresolved external symbol

5. Linking error 2019 unresolved external symbol _main when porting to .NET

6. Linking error 2019 unresolved external symbol _main ...

7. Borland C++ 5.0: error: Unresolved external

8. Error: Unresolved external '_fcopy'?

9. Error LNK20001 unresolved external symbol main.

10. error LNK2001: unresolved external symbol _ntohl@4

11. error LINK2001: unresolved external symbol _capCreateCaptureWindowA@32

12. msvc link-error: _printf unresolved external

 

 
Powered by phpBB® Forum Software