LoginSignup
1
0

More than 5 years have passed since last update.

Nimのプログラムをコンパイルしようとしたら ”error: size of array 'assert_numbits' is negative” とかいうエラーが出た話

Posted at

nimとかいうPythonライクな構文の言語 (Pascalの方が近い?) があるという情報を聞いたので試してみようとしたら,ちょっとハマったのでメモ.

nimについては以下のリンク先が詳しいのでそちらを参照されたい.

Nimの紹介 − Python風静的型付言語 〜コンパイラと型推論を添えて〜 - Blank File

コンパイルしようとしたら以下のようなエラーが出てきた.

c:\users\<user name>\nim>nim compile --run fib.nim
Hint: system [Processing]
Hint: fib [Processing]
CC: fib
CC: stdlib_system
In file included from c:\users\<user name>\nim\nimcache\fib.c:9:0:
C:\Nim\lib/nimbase.h:412:13: error: size of array 'assert_numbits' is negative
 typedef int assert_numbits[sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8 ? 1 : -1];
             ^
In file included from c:\users\<user name>\nim\nimcache\stdlib_system.c:9:0:
C:\Nim\lib/nimbase.h:412:13: error: size of array 'assert_numbits' is negative
 typedef int assert_numbits[sizeof(NI) == sizeof(void*) && NIM_INTBITS == sizeof(NI)*8 ? 1 : -1];
             ^
Hint:  [Link]
gcc.exe: error: c:\users\<user name>\nim\nimcache\stdlib_system.o: No such file or directory
gcc.exe: error: c:\users\<user name>\nim\nimcache\fib.o: No such file or directory
gcc.exe: fatal error: no input files
compilation terminated.
Error: execution of an external program failed: 'gcc.exe   -o c:\users\<user name>\nim\fib.exe  c:\users\<user name>\nim\nimcache\stdlib_system.o c:\users\<user name>\nim\nimcache\fib.o  '

ここによると自分の環境に元々入ってるMinGWじゃだめらしい.nimをインストールするときに一緒にインストールしたMinGWの中のgccを使ったらうまくコンパイルできた.めでたしめでたし.

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0