Open CASCADE, the 3D modelling kernel
3D modeling & numerical simulation

Search the Forums
See All Topics
 

How to re-build OpenCascade 6.3 for Visual Studio 2005

How to re-build OpenCascade 6.3 for Visual Studio 2005
Mike Riley 2008/10/27 02:46
Dear All,

I’ve had success re-compiling OpenCascade 6.3 from source using Visual Studio 2005. In the process I have also been able to re-build all of the samples: Qt, Java, MFC and the tutorial code.

I thought I would share the details of the process. (My apologies if I’m repeating a similar post by another forum member, but I hope that other users may find it useful?)

////////////
List of Dependencies (You’ll need these installed before you start anything):

-Visual Studio with SP1
-JAVA JDK (not JRE)
-Tcl, Tk and Tix
-fltk
-Qt4.x.x
You would also do well to install (or check that you’ve already got):
-Microsoft .NET framework 2.0
-Microsoft Windows SDK

NOTES:
-Visual Studio with Service Pack 1 – SP1 available as a download from Microsoft.
-JAVA JDK (don’t just install the JRE if you want the Java sample to build - the JDK comes with the JRE anyway) – I used “jdk-6u7-windows-i586-p.exe”.
-Tcl, Tk and Tix should all be installed to the same directory – I used c:\Tcl Details to follow below.
-fltk – this can be compiled from source, see below.
-Qt4 – Get the .exe not just the source version. I used “qt-win-opensource-4.4.3-mingw.exe”. This version is more useful when building your own Qt projects. (Qt isn’t strictly necessary if you plan to develop all your GUI code with MFC, but it’s needed for building some of the samples and allows you to develop a cross-platform GUI so you’re not limited just to Windows releases. Allow and extra 3-4 hours for building this, but you can start it off and walk away so don’t worry.)

////////////
Now taking each one of these in turn. First the easy ones:

-Visual Studio SP1,
-Microsoft .NET framework 2.0, and
-Microsoft Windows SDK.

Google “Microsoft Visual C++ 2005 SP1 Redistributable Package”. Download & install.
And then “Microsoft .NET Framework Version 2.0”. Download & install.
Lastly, Google:“Microsoft Windows SDK”. Download & install. (I used “Microsoft Windows SDK for Windows Server 2008 and .NET Framework 3.5” and even though I’m on an XP SP3 system, this caused no problems.)

Reboot.
////////////

-Java JDK.
You can Google this again, but you’ll find it’s known as “Java SE Development Kit (JDK) 6 Update 10”

Important note: You should install this to a directory that doesn’t contain spaces in the filename (i.e. DO NOT INSTALL IN C:\Program Files\...”

Ensure that you have an environment variable set for this location once it’s installed. (Add this if you can’t find it) Right-Click MyComputer>Properties>Advanced>Environment Variables>New (system variable)> “JAVAHOME” C:\Progra~1\Java\jdk1.6.0_07. (or where ever you installed it)
You’ll notice that I DID make the mistake of putting it in the Program Files! – It’s recoverable if you enter it as I have (using “Progra~1”).

////////////
-Tcl, Tk and Tix

Unless you’re feeling VERY brave, and you want to compile these from source, you’ll find files on the web that allow you to install these from windows exe’s. It’s painless this way. I wouldn’t recommend compiling from source.

Tcl and Tk come together and are available from a website called “Active State” (http://www.activestate.com/Products/activetcl/index.mhtml). You want “ActiveTcl”. I installed this to C:\Tcl What ever destination you choose, be sure to put Tix in there as well when you get it.

I found an executable for Tix on SourceForge by looking for ”Tix Library for Tcl/Tk” (http://sourceforge.net/project/showfiles.php?group_id=19412 ). Or you could Google the version I found “tix-8.2.0b1-setup.exe”. Install this AFTER Tcl/Tk and, as mentioned above, install to the same folder - therefore, I used C:\Tcl

////////////
-fltk (you CAN build this from source)
http://www.fltk.org/software.php

Regarding fltk, there seems to be two versions of source e.g. 1.3.x.x and 2.x.x.x available at any one time. Get the lower number version. This should have a folder named VC2005 (when you unpack it) and means that you can build it yourself. (You can't build the higher numbered version it seems, as it doesn't have a VS2005 project type). I unpacked it to D:\fltk-1.3.x-r6350\

Load the FLTK solution in Visual Studio and go to Tools > Options > Projects and Solutions > VC++Directories and under "Show directories for:" select "Include files". Select the top directory listed and click the folder icon to insert a new line at the top; enter “D:\fltk-1.3.x-r6350\fltk-1.3.x-r6350”. Now select "Library files", select the top directory listed and click the folder icon to insert a new line at the top; enter “D:\fltk-1.3.x-r6350\fltk-1.3.x-r6350\lib”. Build the solution (F7) and start it (CONTROL-F5). If you are successful, CubeViewd should execute.

////////////
-Qt4.x.x

I used the .exe version of Qt (qt-win-opensource-4.4.3-mingw.exe). It comes with the mingw complier that can be useful when you build you own Qt projects (even if you’re working in VS 2005). So, make sure you get/tick the mingw compiler during the install process.

Go back and “set” some more environment variables. Right-Click MyComputer>Properties>Advanced>Environment Variables>New (system variable)>

Add these two:

SET QTDIR=C:\Qt\4.4.3
(or whatever version\location you have). Also add this
SET QMAKESPEC=win32-msvc2005

You’re going to build Qt with VS2005, so now load Visual Studio. Then : Tools> Visual Studio 2005 Command Prompt>

Move to the place where you installed Qt e.g. “cd c:\qt\4.4.3\” (in my case)

Type “configure” . Wait a bit.
Type “nmake”. Walk away for a few hours.

P.S. Check P Dolbey’s post on this page for a more compressive guidance if you run into problems:
http://www.opencascade.org/org/forum/thread_11268/

Also, now it has built/compiled, make sure that you go back in to your environment variables (as above) and set a couple more now. Edit the PATH setting and add to your existing list “C:\Qt\4.4.3\bin;C:\Qt\4.4.3\lib”; or whatever your path to Qt is - the crucial part is to have the PATH set to look at the “bin” and “lib” folders of Qt.

////////////
That’s pretty much it for the dependencies. It will have taken you half-a-day or more, mainly caused by waiting for Qt to compile. Now you can start to re-build OpenCasacde 6.3.

IMPORTANT NOTE: This is where my guidance varies. I’d done all this myself and carried on in that way I am about to describe, only to find that I couldn’t build the samples! Specifically, some of the folders were missing from the “source” download of OpenCascade. Never-the-less I have managed to get all of the rest of OpenCascade installed (dll’s and lib’s).

So, strangely…I’m going to advise that, even though you’re now about to build OpenCascade from source, I would actually recommend you to get the self-installer “OpenCASCADE_win32.exe” the RAR-Self Executable!! Install it, and then re-build it yourself for VS2005! At least you will have the re-assurance of all the libraries being built for Visual Studio 2005, plus all the alterations you’re about to make to Visual Studio should mean that compiling the samples (and your own code;-) is much easier.

The official advice is to make sure you un-install any previous version of OpenCascade. The OpenCascade self-installer should then run ok because you’ve already got the Java JRE as part of the JDK.

////////////
-OpenCascade 6.3.0

So, you’ve got all the dependencies installed in their respective directories. You’ve also installed OpenCascade6.3 with the self installer. This should have automatically added other environment variables for you as well. Whilst not absolutely essential, we’re going to change some of these environment variables to reflect the dependencies that we’ve just installed. This way, Visual Studio will make use of them as it compiles OpenCascade instead of the ones that it has placed in the “OpenCascade\3rdparty\win32” folder. So, it’s “Right-Click MyComputer>Properties>Advanced>Environment Variables>” again. Make these changes (alter appropriately if you’ve installed the dependencies to other folders of course :-)

TCL_LIBRARY      C:\Tcl\lib\tcl8.5
TCLLIBPATH      C:\Tcl\lib
TIX_LIBRARY      C:\Tcl\lib\tix8.2
TK_LIBRARY      C:\Tcl\lib\tk8.5

And you should already see entries for these:
CASLIBS
CASROOT
Several CFS_’s…
JAVAHOME
QTDIR
And, in addition to all the other PATH entries you have, your path should have these entries:
C:\Tcl\bin;
C:\Qt\4.4.3\bin;
C:\Qt\4.4.3\lib
If not, edit to make sure you have all these

Now, go into Visual Studio 2005. There are changes to be in made here: “Tools>Options>Projects and solutions>VC++ Directories”

We need to make changes to these 3 areas in “Show directories for”
1 -The executable files
2 -The include files
3 -The Library files

I’m going to cut-and-paste from what I have listed. Once again, you’ll need to change these if you’ve installed the dependencies to different directories – for example I’ve installed my OpenCascade and fltk on my D:drive.

1 – The executable files
C:\Qt\4.4.3\bin

2 – The include files
C:\Qt\4.4.3\include\QtCore
C:\Qt\4.4.3\include\QtGui
C:\Qt\4.4.3\include\QtOpenGL
C:\Qt\4.4.3\include\Qt
C:\Qt\4.4.3\include
D:\OpenCASCADE6.3.0\ros\inc
C:\Program Files\JAVA\jdk1.6.0_07\include\win32
C:\Program Files\JAVA\jdk1.6.0_07\include
C:\Tcl\include
D:\fltk-1.3.x-r6350\fltk-1.3.x-r6350

3 -The Library files
D:\OpenCASCADE6.3.0\samples\standard\qt\src
D:\OpenCASCADE6.3.0\ros\win32\libd
D:\OpenCASCADE6.3.0\ros\win32\lib
C:\Tcl\lib
D:\fltk-1.3.x-r6350\fltk-1.3.x-r6350\lib

Finally we’re ready to build!

There is a specific order.

You build the packages in this order and, before you progress onto the next package, make sure the last one has build with no errors (don’t worry about seeing warnings though, it’s just errors=0 that you want to see). Here’s where you should load the solution files from:

\OpenCASCADE6.3.0\ros\adm\win32\vc8

This is the correct build order =

1- Foundation Classes (file FoundationClasses.*)
2- Modeling Data (file ModelingData.*)
3- Modeling Algorithms (file ModelingAlgorithms.*)
4- Visualization (file Visualization.*)
5- Application Framework (file ApplicationFramework.*)
6- Data Exchange (file DataExchange.*)
7- Draw (file Draw.*)
8- WOK (file WOK.*)
9- Wrappers (file Wrappers.*)

Where * is .sln for VC++8.0 (VS2005)

That’s pretty much it! Each time, click on “all” and build with F7. There is one problem that you will occasionally come across though. It’s not a big problem, but these solution files were linked by OpenCascade to expect files called “tcl84.lib” and “tk84.lib”. If, like me, you’ve got a later version of Tcl/Tk you will have to make changes when you find build problems….

Specifically, when building “Draw” in Visual Studio,
DRAWEXE
TKDraw
TKViewerTest
required me to right click on each of them in “Solution Explorer” then: >Properties> Linker>Input>AdditionalDependencies and then edit the list. Just change the entries for “tcl84.lib” and “tk84.lib” to “tcl85.lib” and “tk85.lib”. This is because these are the correct file names as found in C:\Tcl\lib. If you’ve got an even later version of tcl and tk then use the filenames in there but, at the time of writing, these are the versions that come from the ActiveTcl.exe installer (above). There are 7 or 8 identical changes to make when you try and build WOK too. You’ll be used to it by then ;-)

That should be it :-)

When I checked the OpenCascade folders, I had 98 new library files in \OpenCASCADE6.3.0\ros\win32\lib - all freshly built, therefore recently dated. And 95 .dll’s in the \OpenCASCADE6.3.0\ros\win32\bin folder with 3 .exe’s (draw.exe, wokprocess.exe, woksh.exe) all recently dated too.

////////////
-Time requirements

I’d leave myself half a day to do all this if I were to do it again….a full day if I was building Qt as part of the process.

////////////
- Samples

I then went on to successfully build the samples without too many problems, and if other users are interested, I can post the process for rebuilding those? Perhaps in another post though (?) as I realise this is already a very long entry.

Regards,

Mike Riley.

////////////
Stefan Boeykens 2008/10/27 09:59
Thank you for sharing
Denis Teissandier 2008/10/27 10:13
Thank you very much for this contribution !!!

I am actually doing a similar job on my computer ... and I have encountered some difficulties with VC++2005.

I had to install Visual Studio with SP1, Microsoft .NET framework 2.0 and Microsoft Windows SDK ...

I would like to know if you have installed : a standard distribution of VC++ 2005 or VC++ 2005 express edition.

What is your OS : XP or Vista ?

Regards,

Denis


Mike Riley 2008/10/27 11:48
Hi Denis,

I'm using the standard VC++2005, not the express and I'm running on XP SP3.

Good luck with your install!

Mike.
P Dolbey 2008/10/28 11:00
This pretty much refects my VS2008 build as well.

Just on trick to add - ActiveState dows provide a Tix implementation as well, but its either in ActivePERL or ActivePython (I'm at work at the moment so don't have access to the distro's) - it doesn't harm to have these installed as well, and you can just the copy the compatible Tix files into the Tcl folder.

Pete
Svetlozar Kostadinov 2008/10/28 16:05
Maybe here is the place to ask this. What is the probability for crashes or other problems when using binaries compiled on different version of VC++? For example - the EXE compiled on 2005 and the DLL compiled on 2008.
Christoph Ertelt 2009/04/23 13:51
Hi Denis!

I too encountered problems during compiling especially beginning with the Draw module (lots of unresolved symbols). It worked when I used the VC7 project files for compiling.
Seems like some manual library dependencies are missing in the VC8 project files. Hopefully it will be fixed some time.

Best regards

Christoph
Thomas Rollmann 2008/11/12 23:23
Dear Mike, thanks for sharing.
I managed it to build opencascade 6.3 with Visual Studio 2005 nearly without problems.
It would be great if you could help me in rebuilding the samples?
This would be great!
Thomas Rollmann 2008/11/12 23:42
I'm especially interested in the C# sample! :-)
Mike Riley 2008/11/29 15:58
Hi Thomas,

I was worried that someone might ask me how to build the C# sample because that's the only one I didn't complete! (I'm not a C# user)

Anyway…I've just tried and it built ok.

I had to install the C# component of Visual Studio 2005.
Then load (and convert) the \OpenCASCADE6.3.0\samples\standard\c#\IE\IE.sln file in Visual Studio.
I tried building a "Release version" but nothing happened apart from an Internet Explorer window opening.
I then changed the "start-up project" to "IE" (not "OCC"), built again, and finally built the release version.

No problems at all.

I should add that it probably went so smoothly because I already have all the bin/library/include directories set up in Visual Studio (as in my long post above) so I would advise others to do the same before trying to build the samples.

Anyway, sorry to have taken so long to reply - you've probably already build it yourself by now Thomas ;-)

Cheers,

Mike.
Joel Cordonnier 2009/07/31 09:00
Hello Mike,

I just start with open cascade on windows. Could you please let me know if i have/can to use "Visual C++ 2008 Express "

the http://www.microsoft.com/germany/express/download/downloaddetails.aspx?p=vcpp

Thank you
Joel
Mike Riley 2009/08/14 00:39
Hi Joel,

I guess you can, but I haven't tried it. Perhaps you could post back if you've had success?

Also, sorry for taking so long to reply. I hadn't set this article to email me when someone posts a response.

Mike.
Yang Lei 2009/08/03 10:54
Thank you for sharing
Daniel 2010/02/11 07:09
Thank you so much for providing this tutorial. I would have been completely lost without it.

Thought I would contribute a few things I picked up compiling for Visual Studio 2008:
* QT now installs into C://Qt/2010.01/qt/ (that last qt is important)
* The command prompt is no longer in the file menu. But if you go Start > Programs > VS2008 > Tools > it is in there
* I think you need to restart after setting the environment variables, or it seemed to work for me.
* I also had to comment out the headers on the sample files:
/*#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'ApplicationCommon.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 59
#error "This file was generated using the moc from 4.2.3. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif*/

This was throwing an error and does not seem to be needed.


And your time estimate is accurate. It really did take about a day to do, but its all going now, so thank you Mike.
Vallée 2010/08/30 16:17
I want to thank you a lot Mike for your help !
It works perfectly !
Mike Riley 2010/11/09 18:22
I'm really pleased that some other users have found my post useful....I just worry for the day that verison 6.4 is released and I'll have to do the whole thing again ;-)

Mike.
Neil Martin 2011/02/23 11:13
Hi,

Thanks for these instructions, their very easy to follow and useful for rebuilding Open CASCADE.

I do however still have a problem that I was wondering if anyone else had come across, I'm getting the following error anytime I try and start any of the samples and a program I have that uses Open CASCADE:

"The procedure entry point ?BeginScope@Handle_Standard_Transient@@AAEXXZ could not be located in the dynamic link library TKernel.dll."

I've done everything in the above description but still can't get the programs to run, I would appreciate any advice.

Neil
Thomas 2011/02/23 11:54
did you recompile the samples too?
Neil Martin 2011/02/24 12:32
Yes I've rebuilt all the mfc samples but still getting the same error.
Neil Martin 2011/02/24 12:41
I should probably have said I'm using Visual Studio 2008, could this be causing the problem?
Thomas 2011/02/24 13:39
no , it should not depend. This kind of error appears when you linked to a DLL and load a different version of it. Are you *sure* that the DLL you are loading is exactly the one you recompiled? Maybe you have a different version in your PATH? (check the output window to see the exact path of the TKernel.dll)
Neil Martin 2011/02/24 14:31
This could be it, it's loading TKernel.dll from windows\system32 rather than the Open CASCADE folder. How would I change the DLL that is being loaded (sorry, I'm relatively new to this).

Thanks,

Neil
Thomas 2011/02/25 08:10
surely system32 is not the appropriate place to put opencascade libraries.
Either set your "user" PATH env. variable to the opencascade bin folder, or set it in the "debug" options of your projects. Also, copying the new opencascade dlls in the bin folder of the examples will work too.
This is the way windows tryes to find DLLs:
http://msdn.microsoft.com/en-us/library/ms682586%28v=vs.85%29.aspx
Neil Martin 2011/02/25 11:35
Yeah I'd installed and uninstalled Open CASCADE a few times so for some reason one of them must have put DLLs in the system32 folder.

Deleting the files solved the problem.

Thanks for your help.

Neil
 
 
Latest news
  • OCCT Applications
  • Open CASCADE Technology 6.8.0 is available for download!
  • New features to enhance the development process

  • © OPEN CASCADE 2000 - 2014  |  Search  |  Contacts   |  Site map