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

devteam devteam at transvalor.com
Tue Oct 17 08:44:16 CDT 2006


Hi,

I finally almost got it.
I used mpich2.1.0.2p1 (there is no --vs05 option for winconfigure in the mpich2.1.0.4p1 version).

I had to do several things:
In smpd_util project:
    * Add smpd_job.c to the project 
    * add MPICH_IGNORE_CXX_SEEK compilation directive

In mpidu_sock.h:
add CPLUSPLUS_END before #include "mpidu_socki.h and CPLUSPLUS_BEGIN just after

In mpiexec project (same in smpd project) link also with:
    * activeds.lib and netapi32.lib

Then mpiexec compiles and link and there remains undefined symbols related to activeDir stuff. 

In order to generate mpiexec.exe I had to comment out references to IID_IDirectoryObject, IID_IADsContainer,IID_IDirectorySearch in smpd_ad.cpp (but not in smpd_adreg.cpp).

Andres
  ----- Original Message ----- 
  From: Jayesh Krishna 
  To: mpich-discuss at mcs.anl.gov 
  Cc: mpich2-maint at mcs.anl.gov 
  Sent: Monday, October 16, 2006 8:34 PM
  Subject: FW: [MPICH] compilation under VS2005 - get wspiapi.h out of extern "C" block


  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\pm\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/20061017/9395d5a1/attachment.htm>


More information about the mpich-discuss mailing list