That works fine when I set the const from the command line when building:
    
    
       $ nim c -r -d:is_it_for_algo_N=1 algo_1
       $ nim c -r -d:is_it_for_algo_N=2 algo_2
    
    
    Run

But it isn't enough to "set" the const in the algo-specific source file:
    
    
    # In algo_<X>.nim
      const is_it_for_algo_N {.intdefine.} = 1
      import algo_common
    
    
    Run

where your sample code is in algo_common.nim.

I had hoped to keep this sort of config/compile-time setup in the .nim source 
files so there is only one place to look, but supplying the correct value at 
build time via the algo_<X>.nim.cfg is not a hardship.

(BTW: how can I insert a decorated username in my forum replies when 
responding?) 

Reply via email to