[Insight-developers] WIN32 or _WIN32 (Insight does not build with nmake)

Bill Hoffman bill . hoffman at kitware . com
Wed, 31 Jul 2002 13:34:58 -0400


--=====================_12119907==_.ALT
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

Insight gets the following error when building with nmake:

C:\Hoffman\Insight\Code\Common\itkIntTypes.h(29) : error C2632: 'long' followed by 'long' is illegal
C:\Hoffman\Insight\Code\Common\itkIntTypes.h(41) : error C2632: 'long' followed by 'long' is illegal
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.


The problem is with cmake the dsp files add a -DWIN32 that is not done in the nmake Makefiles.   While this may be a bug in cmake, the fix would be to remove the -DWIN32 from the dsp files, and not to add it to the nmake files.   

According the Microsoft documentation:
_WIN32 Defined for applications for Win32®. Always defined. 

So, we should be looking for _WIN32 and not WIN32.

itkWin32Header tries to fix this for cygwin:

#ifndef __itkWIN32Header_h
#define __itkWIN32Header_h

// add in the Windows variants

#if defined(__CYGWIN__)
#ifndef WIN32
#define WIN32 1
#endif
#ifndef _WIN32
#define _WIN32 1
#endif
#endif


But, I guess all of the WIN32 checks should be changed to _WIN32 which is done
by the compiler.  Looks like itkIntTypes is the only one with this problem.
But as a rule we should check for _WIN32.




-Bill

--=====================_12119907==_.ALT
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit

<html>
Insight gets the following error when building with nmake:<br>
<br>
C:\Hoffman\Insight\Code\Common\itkIntTypes.h(29) : error C2632: 'long'
followed by 'long' is illegal<br>
C:\Hoffman\Insight\Code\Common\itkIntTypes.h(41) : error C2632: 'long'
followed by 'long' is illegal<br>
NMAKE : fatal error U1077: 'cl' : return code '0x2'<br>
Stop.<br>
<br>
<br>
The problem is with cmake the dsp files add a -DWIN32 that is not done in
the nmake Makefiles.&nbsp;&nbsp; While this may be a bug in cmake, the
fix would be to remove the -DWIN32 from the dsp files, and not to add it
to the nmake files.&nbsp;&nbsp; <br>
<br>
According the Microsoft documentation:<br>
<b>_WIN32</b> Defined for applications for Win32®. Always defined. <br>
<br>
So, we should be looking for _WIN32 and not WIN32.<br>
<br>
itkWin32Header tries to fix this for cygwin:<br>
<br>
#ifndef __itkWIN32Header_h<br>
#define __itkWIN32Header_h<br>
<br>
// add in the Windows variants<br>
<br>
#if defined(__CYGWIN__)<br>
#ifndef WIN32<br>
#define WIN32 1<br>
#endif<br>
#ifndef _WIN32<br>
#define _WIN32 1<br>
#endif<br>
#endif<br>
<br>
<br>
But, I guess all of the WIN32 checks should be changed to _WIN32 which is
done<br>
by the compiler.&nbsp; Looks like itkIntTypes is the only one with this
problem.<br>
But as a rule we should check for _WIN32.<br>
<br>
<br>
<br>
<br>
-Bill<br>
</html>

--=====================_12119907==_.ALT--