![]() |
Blitz Support : |
From: Julian Cummings (cummings_at_[hidden])
Date: 2005-06-01 15:04:49
Hello Lukasz,
Apparently boost is defining a macro called "min" that is interfering with
blitz when it attempts to define a function called "min" in
<blitz/vecmin.cc>. Defining macros with very generic names like "min" in
header files and then leaving them defined in user code is a *very* bad
idea.
A simple workaround would be to undefine "min" somewhere near the start of
<blitz/vecmin.cc>:
#ifdef min
#undef min
#endif
The only problem with this is that if for some crazy reason boost really
needs this macro sometime later on in the code, it will be gone. You might
want to search in the boost headers to determine where the macro min is
defined and used. The proper solution is for the boost headers to undefine
the min macro when it is no longer needed, so that it does not pollute other
code like this. Incidentally, you may discover a similar problem with "max"
and the header file <blitz/vecmax.cc>, since min and max usually occur
together.
Regards, Julian C.
Dr. Julian C. Cummings
Staff Scientist, CACR/Caltech
(626) 395-2543
cummings_at_[hidden]
> -----Original Message-----
> From: blitz-support-bounces_at_[hidden]
> [mailto:blitz-support-bounces_at_[hidden]] On Behalf Of
> Lukasz Dobrek
> Sent: Thursday, May 26, 2005 6:40 AM
> To: blitz-support_at_[hidden]
> Subject: [Blitz-support] blitz + boost problems
>
> Hi
> I have a problem with using in the same project blitz-0.8
> and boost-1.32, I use VS .NET environment. I didn't test it
> with other compilers, so I don't know whether it is
> reproducable in different setings, but:
>
> this works:
>
> #include <blitz/array.h>
> #include <boost/date_time/posix_time/posix_time.hpp>
> void test()
> {
>
> }
> while this:
>
> #include <boost/date_time/posix_time/posix_time.hpp>
> #include <blitz/array.h>
> void test()
> {
> }
>
> does not. It failes with plenty of syntax errors:
>
> c:\ALM_Hybrid\blitz\blitz\vecmin.cc(59) : warning C4003: not
> enough actual parameters for macro 'min'
> c:\ALM_Hybrid\blitz\blitz\vecmin.cc(59) : error C2226: syntax error :
> unexpected type 'blitz::Vector<P_numtype>'
> c:\ALM_Hybrid\blitz\blitz\vecmin.cc(59) : error C2988:
> unrecognizable template declaration/definition
> c:\ALM_Hybrid\blitz\blitz\vecmin.cc(59) : error C2059: syntax
> error : ')'
> c:\ALM_Hybrid\blitz\blitz\vecmin.cc(59) : error C2059: syntax
> error : ')'
> c:\ALM_Hybrid\blitz\blitz\vecmin.cc(67) : error C2653:
> 'P_expr' : is not a class or namespace name
> c:\ALM_Hybrid\blitz\blitz\vecmin.cc(67) : error C2146: syntax error :
> missing ',' before identifier 'T_numtype'
> c:\ALM_Hybrid\blitz\blitz\vecmin.cc(67) : error C2065: 'T_numtype' :
> undeclared identifier
>
> and so on and on.
>
>
> I don't know whether it is more blitz or more boost issue,
> but As the errors appear to come from Blitz I send it first heare.
>
> Regrads
> Lukasz
>
> _______________________________________________
> Blitz-support mailing list
> Blitz-support_at_[hidden]
> http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support
>
>