FW: [MPICH] compilation under VS2005 - get wspiapi.h out of extern "C" block

Jayesh Krishna jayesh at mcs.anl.gov
Mon Oct 16 13:34:46 CDT 2006


Hi,
 In VS 2005 there are C++ templates in some of the header files (VS 2003 did
not have them). So these header files should be considered as C++ header
files rather than C header files and one has to make sure that these C++
header files are outside the extern "C" {} blocks in the code.
 One such C++ header file is <wspiapi.h>. If you make sure that this header
file is not included in an extern "C" {} block you should be able to get
past this compilation error (Please note that this header file may be
included by some other header files in an extern "C" block. To know the list
of header files included by your source code and the order in which they are
included enable "show includes" in Visual studio.).
 This code works for Visual Studio 2003 and we will be changing the code to
make it compatible with VS 2005 in our next release.
 Please let us know if this works for you.
 
Regards,

----------------------------------
 Jayesh Krishna
 Argonne National Laboratory
 Mathematics and Computer Science
 Email: jayesh at mcs.anl.gov
---------------------------------- 

 

  _____  

From: owner-mpich-discuss at mcs.anl.gov
[mailto:owner-mpich-discuss at mcs.anl.gov] On Behalf Of devteam
Sent: Monday, October 16, 2006 3:23 AM
To: mpich-discuss at mcs.anl.gov
Subject: [MPICH] compilation under VS2005


Hello everyone,
 
We've trying to compile mpich2 under VS2005, with no success yet... here is
the error message.
 
Any suggestions on what's going wrong ?
 
Thank you,
 
Andres
 
 
in wsiapi.h
 

#if !defined(_WSPIAPI_COUNTOF)
#if !defined(__cplusplus)
#define _WSPIAPI_COUNTOF(_Array) (sizeof(_Array) / sizeof(_Array[0]))
#else
template <typename __CountofType, size_t _N>
char (&__wspiapi_countof_helper(__CountofType (&_Array)[_N]))[_N];
#define _WSPIAPI_COUNTOF(_Array) sizeof(__wspiapi_countof_helper(_Array))
#endif
#endif
 
error message: 
 
1>------ Build started: Project: smpd_util, Configuration: Debug Win32
------
1>Compiling...
1>smpd_adreg.cpp
1>c:\program files\microsoft visual studio
8\vc\platformsdk\include\wspiapi.h(44) : error C2894: templates cannot be
declared to have 'C' linkage
1>Build log was saved at
"file://d:\DEVELOPPEMENTS\MPICH2\Argonne\mpich2-1.0.2p1\mpich2-1.0.2p1\src\p
m\smpd\smpd_utilDebug\BuildLog.htm"
1>smpd_util - 1 error(s), 0 warning(s)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/mpich-discuss/attachments/20061016/d68d34ad/attachment.htm>


More information about the mpich-discuss mailing list