For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Compilation error with new extension for Draw/Use MakeBottle.cxx tutorial code

Sven Kiesser's picture
Forums: 

Hello,

yesterday I started using Open Cascade Library. I was successfully able to compile Cascade on Kubuntu with
Automake and launch Draw with the provided tcl samples.

My overall goal is it to write an algorithm that gets a mesh of an object as input and then detects cylindric
holes in it. I think i can accomplish this by extending Draw with my own Code/Algorithm.

To better understand how i can extend Draw with my own code i tried to follow this tutorial (shows how to extend
Draw with a new command):
http://opencascade.wikidot.com/tutorial-started-by-semikin:drawexe-very-simple-examples-no
So i opened Code::Blocks in Kubuntu, wrote the code of HelloWorld.h, HelloWorld.cpp and main.cpp and added the paths of the tcl and cascade installation folders to Code::Blocks for compiling/linking.
My own code (the one from the tutorial) compiles just fine, but Code::Blocks shows me an error in
"Standard_values.h":

error: "error: check config.h file or compilation options: either HAVE_LIMITS or HAVE_LIMITS_H should be defined"

This is the exact error message that is defined in "Standard_Values.h" in line 34, so i think the problem has to
be in my cascade environment. Maybe i've forgotten to include some libraries or set up some environment variables?

Maybe extending Draw with a new command is not the best solution for my project, but then i'm currently not quite
sure how to extend cascade with my own code/algorithm. I saw this tutorial:
http://www.opencascade.org/doc/occt-6.7.1/overview/html/occt__tutorial.html

But i don't really know how to run cascade with this code/the tutorial.

Thank you very much
- skmCry

Forum supervisor's picture

Dear Sven,
We would suggested you to check installation and building instructions at the next chapters of OCCT html documentation:
- Open CASCADE Technology/Installation
- Open CASCADE Technology/Developer Guides/Building OCCT from sources
Best regards
FSR

Daniel Neander's picture

Hello Sven,

DRAWEXE is used for testing purposes, ie testing features of OCC and visualisation.
To get your project underway, start by building the samples located in your OCC directory. I recommend building the import/export Qt sample, as it has the basic framework of an OCC application.
I am not sure why you are receiving your error, #define HAVE_LIMITS will fix that error, but will probably produce more as it should be defined in the config file. Maybe someone with experience with your system and compiler can help.

Kind regards
Daniel Neander

Sven Kiesser's picture

Hello,

many thanks for the quick replay and help. In the last couple of hours i've installed Open
CASCADE on Windows 7 and set it put with Visual Studio 2012. On this System Open CASCADE and the
assigned tutorial above (on how to extend Draw with own commands) are working. :)
I still have the problems with Kubuntu, but at least i have a working environment for CASCADE
on Windows now, so i can start coding. By configuring Open CASCADE on Windows, i think that
some of the environment variables might be wrong on Kubuntu, that causes the above problems
of my first post. If i'll find a solution, i'm going to post it here.

Thanks
Sven

Sven Kiesser's picture

Ok, now i've fixed the above error. I had to add some libraries to the build options
of Code::Blocks. Now my program which extends Draw compiles, but when i start it, i get the
following error message:

"the CASROOT variable is mandatory to Run OpenCascade".

When i launch ./draw.sh outside of Code::Blocks by Terminal i don't have this error, so it
seems to me, that i have to define the CASROOT variable extra in Code::Blocks.
Does someone know how to do that?

But to make sure, can somebody explain me how to set the CASROOT and other necessary CASCADE
variables in general?
I run ./env.sh CASROOT="". Is this alright?
(System: Kubuntu)

Many thanks
Sven

Sven Kiesser's picture

I'm sorry for my double posts, but finally here is my solution to extend DRAW for future
reference. CASCADE works with my own code in Code::Blocks and Kubuntu (in VirtualBox) now:

1) Compile Cascade with Automake following these two tutorials:
http://www.opencascade.org/doc/occt-6.7.1/overview/html/occt_dev_guides__building.html
http://www.opencascade.org/doc/occt-6.7.1/overview/html/occt_dev_guides__building_automake.html

2) Create a new project in Code::Blocks with the code from this tutorial:
http://opencascade.wikidot.com/tutorial-started-by-semikin:drawexe-very-simple-examples-no

Now Code::Blocks needs some information to compile the code successfully.

3) In the Build options of the new created project in Code::Blocks add the following:
- In "Search directories" (Compiler) add the include directories of Cascade and all other
3rd party libraries (Tcl, Tk, Freetype, ...)
- In "Search Directories" (Linker) add the lib directories of Cascade and all other 3rd party
libraries (Tcl, TK, Freetype, ...)

If Code::Blocks doesn't find the libraries, add the nessary libraries to "Linker settings"
manually. For the above tutorial these are: libTKDraw.so, libTKernel.so, libTKMath.so,
libtcl8.6.so, libtk8.6.so

I'm not sure if the following step is ok (see previous post from Daniel Neander), but i had to
do it to compile the code:
In the Build options of the Code::Blocks project go to "Compilter settings" and "#defines"
and add "HAVE_LIMITS_H", "HAVE_IOSTREAM", "HAVE_IOMANIP" (without "")

4) Add environment varialbes to Kubuntu:
Open the /etc/environment file with the Terminal and add CASROOT="Path-to-Cascade-root-folder" (with "").
Depending on the project you might need some more varialbes from this page:
http://www.opencascade.org/doc/occt-6.7.1/overview/html/index.html#OCCT_OVW_SECTION_4

Now the code from the Draw-Tutorial compiles just fine and works. :)

- Sven

CONNECT WITH US

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.