Hello,

I have made few changes to my code like included the CAN Dll file with in my Application code.I am using VS 2008 and after compiling I am getting this error:

Code:
1>------ Build started: Project: NetworkComm, Configuration: Release Win32 ------
1>Compiling...
1>ServerMain.cpp
1>c:\users\xzpgbn\desktop\networkcommdll\networkcomm\stdafx.h(13) : warning C4005: 'WINVER' : macro redefinition
1>        C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\sdkddkver.h(166) : see previous definition of 'WINVER'
1>C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\afxv_w32.h(16) : fatal error C1189: #error :  WINDOWS.H already included.  MFC apps must not #include <windows.h>
1>Build log was saved at "file://c:\Users\xzpgbn\Desktop\NetworkCommDll\NetworkComm\Release\BuildLog.htm"
1>NetworkComm - 1 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
I am including all my Headers file below

Code:
Stdafx.h
=======
#pragma once
#define WINVER 0x500
#include <iostream>
#include <stdio.h>
#include "targetver.h"
#include <tchar.h>
#define _CRT_RAND_S
#include <stdlib.h>
#include <stdio.h>
#include <limits.h>
//#include "vxlapi.h"
//#include <windows.h>
#include <afxwin.h>
#ifndef _SECURE_ATL
#define _SECURE_ATL 1
#endif
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0500	 // Allow use of features specific to Windows XP.
#endif
#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN            // Exclude rarely-used stuff from Windows headers
#endif
//#include "targetver.h"
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS      // some CString constructors will be explicit
// turns off MFC's hiding of some common and often safely ignored warning messages
#define _AFX_ALL_WARNINGS
#define _AFXDLL
#include <afxwin.h>         // MFC core and standard components
#include <afxext.h>         // MFC extensions
#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h>           // MFC support for Internet Explorer 4 Common Controls
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>             // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <afxcontrolbars.h>     // MFC support for ribbons and control bars
#include <afx.h>
#include <afxdhtml.h>
#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif

c_settings.h
=========
#pragma once
//#include "windows.h"
#include <winsock2.h>
#include <string.h>

c_settings.cpp
===========
#include "stdafx.h"
#include "c_settings.h"
using namespace System;
#pragma warning(disable: 4996)

global_variables.h
=============
#pragma once
#pragma comment(lib,"Ws2_32.lib")
//standard windows headers
#include "stdafx.h"
//#include "windows.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <winsock2.h>
#include <time.h>
#include <iostream>
#include <conio.h>
#include <fstream>
#include <cstdlib>
#include "Global_Threads.h"
#include "Dll.h"
#include "msg_manip.h"
#include "ParseDbcFile.h"
#include "c_settings.h"
#include "Server.h"
#include "messages.h"
#include "CanMsg.h"
#include "Logic.h"
using namespace std;

global_variables.cpp
===============
#include "stdafx.h"
#include "Global_Variables.h"
#include "Server.h"

server_main.cpp
============

I think the error is in this file:

#pragma comment(lib,"Ws2_32.lib")
#define _WIN32_WINNT 0x0500
//#include "afxwin.h"
#include "Windows.h"
#include "stdafx.h"
#include <iostream>
#include <conio.h>
#include <fstream>
#include <cstdlib>
#include "Server.h"
#include "Global_Variables.h"
#include "math.h"
#include "Dll.h"
#include "Messages.h"
#include "CanMsg.h"

Dll.h
===
vxlapi.h

Dll.cpp
=====
#if defined(_Windows) || defined(_MSC_VER) || defined (__GNUC__)
 #define  STRICT
#include "windows.h"
//#include <afxwin.h>
#endif
//#include "stdafx.h"
#include <stdio.h>
#include <stdlib.h>
//#include <stdexcept>
#pragma once
#include "vxlapi.h"
#include "Dll.h"
#include <stdexcept>

Dll's stdafx.h
==========
#pragma once
//#include <windows.h>
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN             // Exclude rarely-used stuff from Windows headers
#include <windows.h>