[patch] Re: [vtkusers] Error Compiling VTK on latest Cygwin

Mumit Khan khan at nanotech.wisc.edu
Mon Jan 20 12:52:17 EST 2003


On Sun, 19 Jan 2003, Wahid Alizada wrote:

> I've installed Cygwin and am now trying to install VTK.
>
> I ran non-interactive cmake and the makefiles were created successfully.
>
> After running make (for the second time), here's a snippet of the error:
>
> ------------------
>
> $ make
[ ... ]
> In file included from /home/wahid/VTK/Utilities/tiff/tif_jpeg.c:56:
> /home/wahid/VTK/Utilities/jpeg/jpeglib.h:94: parse error before "boolean"
> /home/wahid/VTK/Utilities/jpeg/jpeglib.h:94: warning: no semicolon at end of
> struct or union
> /home/wahid/VTK/Utilities/jpeg/jpeglib.h:95: warning: data definition has no
> type or storage class
>

The problem is the historical namespace pollution by both system headers
and by other user applications, and have applications try to work around
by making assumptions as to what headers these might already be defined
in. The following patch, against VTK CVS, should get you going.

The change the Common/vtkDynamicLoader.cxx is needed as there is no
conversion from pointer to function to void* in ISO C++, even if you
use reinterpret_cast, so a C-style cast is necessary.

2003-01-20  Mumit Khan  <khan at nanotech.wisc.edu>

	* Common/vtkDynamicLoader.cxx (vtkDynamicLoader::GetSymbolAddress):
	Use explicit cast.
	* Utilities/jpeg/jconfig.h (boolean): Workaround for Cygwin.

Index: Common/vtkDynamicLoader.cxx
===================================================================
RCS file: /cvsroot/VTK/VTK/Common/vtkDynamicLoader.cxx,v
retrieving revision 1.11
diff -u -3 -p -r1.11 vtkDynamicLoader.cxx
--- Common/vtkDynamicLoader.cxx	17 Dec 2002 21:25:56 -0000	1.11
+++ Common/vtkDynamicLoader.cxx	20 Jan 2003 17:49:01 -0000
@@ -171,11 +171,11 @@ void* vtkDynamicLoader::GetSymbolAddress
 #ifdef UNICODE
         wchar_t *wsym = new wchar_t [mbstowcs(NULL, sym, 32000)];
         mbstowcs(wsym, sym, 32000);
-        void *ret = GetProcAddress(lib, wsym);
+        void *ret = (void*)GetProcAddress(lib, wsym);
         delete [] wsym;
         return ret;
 #else
-  return GetProcAddress(lib, sym);
+  return (void*)GetProcAddress(lib, sym);
 #endif
 }

Index: Utilities/jpeg/jconfig.h
===================================================================
RCS file: /cvsroot/VTK/VTK/Utilities/jpeg/jconfig.h,v
retrieving revision 1.2
diff -u -3 -p -r1.2 jconfig.h
--- Utilities/jpeg/jconfig.h	4 Jan 2002 14:30:46 -0000	1.2
+++ Utilities/jpeg/jconfig.h	20 Jan 2003 17:49:01 -0000
@@ -23,7 +23,8 @@

 #ifdef _WIN32
 /* Define "boolean" as unsigned char, not int, per Windows custom */
-#ifndef __RPCNDR_H__            /* don't conflict if rpcndr.h already read */
+/* don't conflict if rpcndr.h already read, unless building under Cygwin */
+#if !defined(__RPCNDR_H__) || defined(__CYGWIN__)
 typedef unsigned char boolean;
 #endif
 #define HAVE_BOOLEAN            /* prevent jmorecfg.h from redefining it */




More information about the vtkusers mailing list