[Lemon-user] compile error

Alpár Jüttner alpar at cs.elte.hu
Fri Nov 26 06:16:52 CET 2010


Hi,
> 
> My bad. I had EPSILON defined  in my code too, and hence the error.
> It's alright now. 

Using #define for defining constants is always a source of danger, for
it overrides everything, even the local variables. Instead, use

const double EPSILON=1e-3;

(just like lemon/graph_to_eps.h does), and you won't have problems like
that.

If you _must_ use define, then always add a prefix that makes your name
different from any other with a high probability, like

#define ARUN_EPSILON 1e-5

In addition, it is a good habit to do all these defines _after_ the
#include lines.

But once again, you will very rarely need it (and _never_ for a single
constant definition like that).

Regards,
Alpar


> 
> Thanks,
> 
> On Thu, Nov 25, 2010 at 8:09 PM, Arun Reddy Kandoor
> <karunreddy30 at gmail.com> wrote:
>         Hi,
>         
>         
>         Am facing a compilation error when I include #include
>         <lemon/graph_to_eps.h>.
>         
>         
>         The error is: 
>         usr/local/include/lemon/graph_to_eps.h: In member function
>         ‘void lemon::GraphToEps<T>::run()’:
>         /usr/local/include/lemon/graph_to_eps.h:665: error: expected
>         unqualified-id before numeric constant
>         
>         
>         Any one else had this error before? Any ideas please.
>         
>         
>         Thanks,
>         -- 
>         Arun 
>         
> 
> 
> 
> -- 
> Arun 
> 
> _______________________________________________
> Lemon-user mailing list
> Lemon-user at lemon.cs.elte.hu
> http://lemon.cs.elte.hu/mailman/listinfo/lemon-user





More information about the Lemon-user mailing list