Building OCC 6.1 with MS VS 2005

After importing and upgrading des solution-files to VS 2005 you have to correct some parts of the code, so that it can compile.

Package WNT:
Index: src/WNT/WNT_DDriver.cxx
===================================================================
--- src/WNT/WNT_DDriver.cxx (revision 10)
+++ src/WNT/WNT_DDriver.cxx (revision 11)
@@ -1058,7 +1058,9 @@
int DrawCount = 0;
int PrevPoint = 0;
MPARAM mp = { &Style, aWidth, aHeight };
- for ( int i = 2; i +
+ int i;
+ for ( i = 2; i if ( Style.SValues ().Value ( i ) ) {
if ( Style.SValues ().Value ( i - 1 ) )
++DrawCount;

Index: src/WNT/WNT_ImageManager.cxx
===================================================================
--- src/WNT/WNT_ImageManager.cxx (revision 10)
+++ src/WNT/WNT_ImageManager.cxx (revision 11)
@@ -67,7 +67,8 @@

if ( myLastIndex && myLastImage -> myHashCode == iHCode ) return myLastIndex;

- for ( int i = 1; i + int i;
+ for ( i = 1; i

if ( myTrash.Value ( i ) -> myHashCode == iHCode ) {

Index: src/WNT/W32_Allocator.cxx
===================================================================
--- src/WNT/W32_Allocator.cxx (revision 10)
+++ src/WNT/W32_Allocator.cxx (revision 11)
@@ -210,11 +210,12 @@

PW32_Block W32_Allocator :: ReserveFind ( unsigned int iSize ) {

- for ( PW32_Block aBlock = myStart; aBlock != NULL; aBlock = aBlock -> next )
+ PW32_Block aBlock = myStart;
+ for ( ; aBlock != NULL; aBlock = aBlock -> next )

- if ( FreeSpace ( aBlock, iSize ) ) break;
+ if ( FreeSpace ( aBlock, iSize ) ) break;

- return aBlock;
+ return aBlock;

} // end W32_Allocator :: ReserveFind

Index: src/WNT/WNT_IconBox.cxx
===================================================================
--- src/WNT/WNT_IconBox.cxx (revision 10)
+++ src/WNT/WNT_IconBox.cxx (revision 11)
@@ -100,7 +100,8 @@
iHCode = myImages -> StringHashCode ( fileName );
len = myImages -> Size ();

- for ( int i = 1; i + int i;
+ for ( i = 1; i

if ( myImages -> HashCode ( i ) == iHCode ) {

@@ -310,7 +311,8 @@
int len = myImages -> Size ();
Handle( WNT_Icon ) icon;

- for ( int i = 1; i + int i;
+ for ( i = 1; i

icon = Handle( WNT_Icon ) :: DownCast ( myImages -> Image ( i ) );

@@ -332,7 +334,8 @@
int len = myImages -> Size ();
Handle( WNT_Icon ) icon;

- for ( int i = 1; i + int i;
+ for ( i = 1; i

icon = Handle( WNT_Icon ) :: DownCast ( myImages -> Image ( i ) );

@@ -361,7 +364,8 @@
Handle( WNT_GraphicDevice ) gDev = Handle( WNT_GraphicDevice ) ::
DownCast ( GraphicDevice () );

- for ( int i = 1; i + int i;
+ for ( i = 1; i

icon = Handle( WNT_Icon ) :: DownCast ( myImages -> Image ( i ) );

Index: src/WNT/WNT_WDriver.cxx
===================================================================
--- src/WNT/WNT_WDriver.cxx (revision 10)
+++ src/WNT/WNT_WDriver.cxx (revision 11)
@@ -895,7 +895,8 @@
int PrevPoint = 0;
MPARAM mp = { &Style, aWidth, aHeight };

- for ( int i = 2; i + int i;
+ for ( i = 2; i

if ( Style.SValues ().Value ( i ) ) {

Package DRAW:
Index: src/XSDRAW/XSDRAW_ProgressIndicator.cxx
===================================================================
--- src/XSDRAW/XSDRAW_ProgressIndicator.cxx (revision 11)
+++ src/XSDRAW/XSDRAW_ProgressIndicator.cxx (revision 12)
@@ -65,7 +65,7 @@
#endif
aTime;
#ifndef _WIN64
- time ( &aTime );
+ time ( (time_t *) &aTime );
#else
time ( (time_t*)&aTime );
#endif

Index: src/SWDRAW/cpulimit.pc
===================================================================
--- src/SWDRAW/cpulimit.pc (revision 11)
+++ src/SWDRAW/cpulimit.pc (revision 12)
@@ -33,7 +33,7 @@
//static Standard_Integer cpulimit(Draw_Interpretor& DI, Standard_Integer n, char** a)
void limitelapsed(int n ) {

- static first=1;
+ static int first=1;

unsigned int __stdcall CpuFunc(void * );

Index: src/Draw/Draw_BasicCommands.cxx
===================================================================
--- src/Draw/Draw_BasicCommands.cxx (revision 11)
+++ src/Draw/Draw_BasicCommands.cxx (revision 12)
@@ -222,7 +222,7 @@

#else
//WNT
- static first=1;
+ static int first=1;
/*
unsigned int __stdcall CpuFunc(void * );
unsigned ThreadID;

Index: src/Draw/CommandWindow.cxx
===================================================================
--- src/Draw/CommandWindow.cxx (revision 11)
+++ src/Draw/CommandWindow.cxx (revision 12)
@@ -199,7 +199,7 @@
char buffer[COMMANDSIZE];
POINT pos;
BOOL rep;
- static nbline; // Taille du buffer de la fenetre d`edition
+ static int nbline; // Taille du buffer de la fenetre d`edition
int index;

switch(wMsg)

Package WOK:
Index: src/WOKNT/WOKNT/WOKNT_Shell_1.cxx
===================================================================
--- src/WOKNT/WOKNT_Shell_1.cxx (revision 12)
+++ src/WOKNT/WOKNT_Shell_1.cxx (revision 13)
@@ -111,7 +111,8 @@

_regExpInit () {

- for ( int i = ( 1 + int i;
+ for ( i = ( 1

caseTrans[ i ] = ( _TUCHAR )i;

Index: src/WOKNT/WOKNT_chmod.cxx
===================================================================
--- src/WOKNT/WOKNT_chmod.cxx (revision 12)
+++ src/WOKNT/WOKNT_chmod.cxx (revision 13)
@@ -44,7 +44,7 @@

static int nFiles;

-extern "C" __declspec( dllexport ) wokCHMOD ( int, char** );
+extern "C" __declspec( dllexport ) int wokCHMOD ( int, char** );

int wokCHMOD ( int argc, char** argv ) {

A few TKs need also an existing TCL/TK installation (e.g. ActiveTCL). You have to add the include and libpath for this in TKDraw, TKViewerTest, TKWOK and TKWOKTcl.

P Dolbey's picture

I described a simpler way of fixing the loop scope problems at the end of

http://www.opencascade.org/org/forum/thread_10904/

but all the other modifications described by Jan are very familiar.

Pete