Advertisement
Guest User

compilation issue with 0.17.0

a guest
Aug 24th, 2017
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Nim 1.70 KB | None | 0 0
  1. # main.nim
  2. import sequtils, math
  3.  
  4.  
  5. iterator efibs: int {. closure .} =
  6.   var prev = 1
  7.   var cur  = 2
  8.   yield 1
  9.   yield 2
  10.   while true:
  11.     let sum = prev + cur
  12.     prev = cur
  13.     cur = sum
  14.     yield sum
  15.  
  16. proc until( iter:   iterator: int,
  17.             stopAt: int
  18.            ): iterator: int {. closure .}  =
  19.   return iterator: int =
  20.     for i in iter():
  21.       if i <= stopAt: yield i
  22.       else: break
  23.  
  24.  
  25. proc isEven(i:int):bool = (i mod 2) == 0
  26.  
  27. echo efibs.until(4_000_000)()
  28.           .toSeq()
  29.           .filter(isEven)
  30.           .sum()
  31.  
  32. #[ command line output
  33.  
  34. jesse@yubintoo:~/src/blockout$ nim c main.nim
  35. Hint: used config file '/home/jesse/nim/config/nim.cfg' [Conf]
  36. Hint: system [Processing]
  37. Hint: main [Processing]
  38. Hint: sequtils [Processing]
  39. Hint: math [Processing]
  40. CC: main
  41. Error: execution of an external compiler program 'gcc -c  -w  -I/home/jesse/nim/lib -o /home/jesse/src/blockout/nimcache/main.o /home/jesse/src/blockout/nimcache/main.c' failed with exit code: 1
  42.  
  43. /home/jesse/src/blockout/nimcache/main.c: In function ‘NimMainModule’:
  44. /home/jesse/src/blockout/nimcache/main.c:582:44: error: redeclaration of ‘efibs’ with no linkage
  45.     Env_maindotnim__exfSYnGAibIzlFbeF0CX8w* efibs;
  46.                                             ^
  47. /home/jesse/src/blockout/nimcache/main.c:579:44: note: previous declaration of ‘efibs’ was here
  48.     Env_maindotnim__exfSYnGAibIzlFbeF0CX8w* efibs;
  49.                                             ^
  50. jesse@yubintoo:~/src/blockout$ nim --version
  51. Nim Compiler Version 0.17.0 (2017-05-17) [Linux: amd64]
  52. Copyright (c) 2006-2017 by Andreas Rumpf
  53.  
  54. git hash: d3f0f87e81e262ee25fd528aae5b6db0bdf78d5e
  55. active boot switches: -d:release
  56.  
  57. ]#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement