Problem using CGAL with OpenCV under Windows and MFC

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem using CGAL with OpenCV under Windows and MFC

beristainandoni
Good afternoon,

I am trying the CGAL libraries to compute the Medial-Axis of a contour. I get
that contour using OpenCV, and I have to use OpenCV. This is part of my tesis
research work so I am really interested in completing my tests as soon as
possible.

Unfortunately, I think that there is some kind of incompatibility between
OpenCV and CGAL and I can not figure out how to solve it.

All the errors are related to the Assertions.h file:

Example:
\include\cgal\assertions.h(34) : error C2143: syntax error : missing '}' before
'goto'
...many other error of the same type....
include\cgal\io\io_tags.h(28) : error C2143: syntax error : missing ';' before
'{'
...many other error of the same type....
\include\cgal\io\io.h(137) : error C4430: missing type specifier - int assumed.
Note: C++ does not support default-int
...

I am using the latest version of the CGAL libraries (v. 3.3.1). I am also
working in a Windows XP environment and Visual Studio 2005. I am using the
latest version of OpenCV (v 1.0 release) and DirectShow.

I hope you can help me solve this problem so I can use your impressive library.

Thanks in advance and I look forward to hear from you soon.
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Problem using CGAL with OpenCV under Windows and

Sylvain Pion
Administrator
[hidden email] wrote:

> Good afternoon,
>
> I am trying the CGAL libraries to compute the Medial-Axis of a contour. I get
> that contour using OpenCV, and I have to use OpenCV. This is part of my tesis
> research work so I am really interested in completing my tests as soon as
> possible.
>
> Unfortunately, I think that there is some kind of incompatibility between
> OpenCV and CGAL and I can not figure out how to solve it.
>
> All the errors are related to the Assertions.h file:
>
> Example:
> \include\cgal\assertions.h(34) : error C2143: syntax error : missing '}' before
> 'goto'
This line is:

enum Failure_behaviour { ABORT, EXIT, EXIT_WITH_SUCCESS, CONTINUE,
                         THROW_EXCEPTION };

What most probably happens is that OpenCV (or other software you use), defines
one of these names as a macro, which clashes with CGAL's enum.

One probable fix is to include CGAL's header first, before the other problematic
headers that defines the macro in question.
(and maybe suggest that OpenCV does not define macros with such general names:
 good practice for libraries is to have macros with prefixes to avoid clashes)

--
Sylvain Pion
INRIA Sophia-Antipolis
Geometrica Project-Team
CGAL, http://cgal.org/

smime.p7s (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problem using CGAL with OpenCV under Windows and MFC

Laurent Rineau (GeometryFactory)
In reply to this post by beristainandoni
On Friday 21 November 2008 16:17:34 [hidden email] wrote:

> Good afternoon,
>
> I am trying the CGAL libraries to compute the Medial-Axis of a contour. I
> get that contour using OpenCV, and I have to use OpenCV. This is part of my
> tesis research work so I am really interested in completing my tests as
> soon as possible.
>
> Unfortunately, I think that there is some kind of incompatibility between
> OpenCV and CGAL and I can not figure out how to solve it.
>
> All the errors are related to the Assertions.h file:
>
> Example:
> \include\cgal\assertions.h(34) : error C2143: syntax error : missing '}'
> before 'goto'
> ...many other error of the same type....
> include\cgal\io\io_tags.h(28) : error C2143: syntax error : missing ';'
> before '{'
> ...many other error of the same type....
> \include\cgal\io\io.h(137) : error C4430: missing type specifier - int
> assumed. Note: C++ does not support default-int
> ...

Most probably there as macros around.
Try to call:
  #undef EXIT
  #undef CONTINUE
before including CGAL headers.


Note that the filenames of headers are case sensitive, even if your compiler
does not care. That is <CGAL/assertions.h>, <CGAL/IO/io_tags.h>, and
<CGAL/IO/io.h>.

--
Laurent Rineau, PhD
Engineer at GeometryFactory
http://www.geometryfactory.com/
--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Problem using CGAL with OpenCV under Windows and

beristainandoni
In reply to this post by Sylvain Pion
Thank you. I have reordered the include statatements so the CGAL ones come first and the problem is fixed.


--- El vie, 21/11/08, Sylvain Pion <[hidden email]> escribió:

> De: Sylvain Pion <[hidden email]>
> Asunto: Re: [cgal-discuss] Problem using CGAL with OpenCV under Windows and
> Para: [hidden email]
> Fecha: viernes, 21 noviembre, 2008 4:27
> [hidden email] wrote:
> > Good afternoon,
> >
> > I am trying the CGAL libraries to compute the
> Medial-Axis of a contour. I get
> > that contour using OpenCV, and I have to use OpenCV.
> This is part of my tesis
> > research work so I am really interested in completing
> my tests as soon as
> > possible.
> >
> > Unfortunately, I think that there is some kind of
> incompatibility between
> > OpenCV and CGAL and I can not figure out how to solve
> it.
> >
> > All the errors are related to the Assertions.h file:
> >
> > Example:
> > \include\cgal\assertions.h(34) : error
> C2143: syntax error : missing '}' before
> > 'goto'
>
> This line is:
>
> enum Failure_behaviour { ABORT, EXIT, EXIT_WITH_SUCCESS,
> CONTINUE,
>                         THROW_EXCEPTION };
>
> What most probably happens is that OpenCV (or other
> software you use), defines
> one of these names as a macro, which clashes with
> CGAL's enum.
>
> One probable fix is to include CGAL's header first,
> before the other problematic
> headers that defines the macro in question.
> (and maybe suggest that OpenCV does not define macros with
> such general names:
> good practice for libraries is to have macros with prefixes
> to avoid clashes)
>
> -- Sylvain Pion
> INRIA Sophia-Antipolis
> Geometrica Project-Team
> CGAL, http://cgal.org/



--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss
Reply | Threaded
Open this post in threaded view
|

Re: Problem using CGAL with OpenCV under Windows and MFC

beristainandoni
In reply to this post by Laurent Rineau (GeometryFactory)
Thank you very much. Your solution fixed the problem.


--- El vie, 21/11/08, Laurent Rineau <[hidden email]> escribió:

> De: Laurent Rineau <[hidden email]>
> Asunto: Re: [cgal-discuss] Problem using CGAL with OpenCV under Windows and MFC
> Para: [hidden email]
> Fecha: viernes, 21 noviembre, 2008 4:29
> On Friday 21 November 2008 16:17:34 [hidden email]
> wrote:
> > Good afternoon,
> >
> > I am trying the CGAL libraries to compute the
> Medial-Axis of a contour. I
> > get that contour using OpenCV, and I have to use
> OpenCV. This is part of my
> > tesis research work so I am really interested in
> completing my tests as
> > soon as possible.
> >
> > Unfortunately, I think that there is some kind of
> incompatibility between
> > OpenCV and CGAL and I can not figure out how to solve
> it.
> >
> > All the errors are related to the Assertions.h file:
> >
> > Example:
> > \include\cgal\assertions.h(34) : error
> C2143: syntax error : missing '}'
> > before 'goto'
> > ...many other error of the same type....
> > include\cgal\io\io_tags.h(28) : error
> C2143: syntax error : missing ';'
> > before '{'
> > ...many other error of the same type....
> > \include\cgal\io\io.h(137) : error
> C4430: missing type specifier - int
> > assumed. Note: C++ does not support default-int
> > ...
>
> Most probably there as macros around.
> Try to call:
>   #undef EXIT
>   #undef CONTINUE
> before including CGAL headers.
>
>
> Note that the filenames of headers are case sensitive, even
> if your compiler
> does not care. That is <CGAL/assertions.h>,
> <CGAL/IO/io_tags.h>, and
> <CGAL/IO/io.h>.
>
> --
> Laurent Rineau, PhD
> Engineer at GeometryFactory
> http://www.geometryfactory.com/
> --
> You are currently subscribed to cgal-discuss.
> To unsubscribe or access the archives, go to
> https://lists-sop.inria.fr/wws/info/cgal-discuss



--
You are currently subscribed to cgal-discuss.
To unsubscribe or access the archives, go to
https://lists-sop.inria.fr/wws/info/cgal-discuss