![]() |
| | #1 | |
| Registered User Join Date: Jun 2009
Posts: 4
| Getting Winsock.h instead of Winsock2.h... MSVC++ Problem # 2 Common Background Information: I am trying to rebuild code for a working, commercially sold application with only partial build instructions. The previous maintainer of the code (a mixture of C and C++) is no longer with the company, but when he built the code he used MSVC++, and though I am not certain of the version he was using, I think it was either 4.0 or 6.0. I have only a little experience building with this environment (I am otherwise a seasoned developer) so I need help getting past a couple of issues that I have encountered. Computers (and backups of those computers) previously used for running this build are now completely unavailable. I have set up the build on my system using MSVC++ 6.0. The source repository contained a workspace (.dsw) file that I am using for all of the projects. I do not have specific instructions for this product on how to adjust the references to libraries, includes, etc. for a particular machine, but I am using instructions for this from a similar (in terms of languages and tools used) product that was written around the same time. I have gotten 43 of 53 classes (projects) to build, but am getting primarily two errors with the remaining 10 clases (projects). Because I know this code base was building properly (for someone else who is no longer available on a machine that is no longer available), I would strongly prefer adjustments to the build environment over code modification to get it to work, so please focus your assistance/suggestions in this area. Thanks ! Problem #2: Getting Winsock.h instead of Winsock2.h Here is part of the output I am receiving when I build: Quote:
Code: WSANETWORKEVENTS netevents;
DWORD wait_value, wait_index;
HANDLE hSocketEvent;
SOCKET hIpcSocket;
struct FXDEV_DS_MSG msg;
sprintf( tcaller, "fxcipc(%6d)", GetCurrentThreadId( ) );
trace_add_caller( 0, tcaller );
trace( 7, "Start IPCThreadProc.\n");
del_shut( );
hIpcSocket = ( SOCKET ) SocketHandle;
if ( ( hSocketEvent = WSACreateEvent( ) ) == WSA_INVALID_EVENT )
{
trace( 3, "Error: Unable to create monitor event [%d].\n", WSAGetLastError( ) );
ExitProcess( 0 );
}
if ( WSAEventSelect( hIpcSocket, hSocketEvent, FD_READ | FD_CLOSE ) == SOCKET_ERROR )
{
trace( 3, "Error: Unable to set monitor event [%d].\n", WSAGetLastError( ) );
ExitProcess( 0 );
}
while ( 1 )
{ trace( 7, "Run IPCThreadProc.\n");
wait_value = WaitForSingleObject( hSocketEvent, INFINITE );
So the question is, "How am I getting Winsock.h when I know the code is designed and was previously built using Winsock2.h?" Any thoughts or suggestions from an experienced MSVC++ user would be greatly appreciated. | |
| imaloner is offline | |
| | #2 |
| and the Hat of Guessing Join Date: Nov 2007
Posts: 8,740
| Silly question: Do you have winsock2.h or winsock.h explicitly included in your source? Also: I seem to remember that windows.h would automatically include winsock.h UNLESS you had a "lean and mean" switch set. |
| tabstop is offline | |
| | #3 |
| Registered User Join Date: Jun 2009
Posts: 4
| This is an update from the original poster.... I received some suggestions that WIN32_LEAN_AND_MEAN should probably be set so that windows.h doesn't include winsock.h. I gave it a try even though my instincts told me that this would not be the root problem, since the workspace contains preprocessor definitions on every project, so if this is required it would already be there. Adding WIN32_LEAN_AND_MEAN to the preprocessor definitions of a couple of project caused a whole bunch of new errors and did not get rid of the old ones. In response to suggestions that I have received regarding changing the order of include and library directory searches... I have tried several different orders with no noticeable impact. The order I have right now is Microsoft SDK first, third party includes and libraries second, and VC98 includes and libraries last. This seems the safest, but again no order seems to work (trying every single permutation would take quite a while.) Lastly, and most importantly, it has come to my attention that the product that I am building is sold only for Server 2000 and Server 2003 and that the previous building of this code base was running on a Server 2003 system. Since I have been trying my builds on an XP machine, I am leaning towards setting up a virtual machine running Server 2003 in which to compile to see if this helps. However, since that will take a while to set up, I was hoping someone out there might have thoughts about whether or not this is likely to help. |
| imaloner is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Laptop Problem | Boomba | Tech Board | 1 | 03-07-2006 06:24 PM |
| Sorting problem.. well actually more of a string problem | fatdunky | C Programming | 5 | 11-07-2005 11:34 PM |
| searching problem | DaMenge | C Programming | 9 | 09-12-2005 01:04 AM |
| MSVC Tutorial problem - Monochrome Palette | colinH | C++ Programming | 4 | 10-30-2002 03:57 AM |
| half ADT (nested struct) problem... | CyC|OpS | C Programming | 1 | 10-26-2002 08:37 AM |