cygwin编译器编译ruby file.c错误

时间:2013-11-26 11:04:31

标签: ruby cygwin

我正在尝试使用编译器cygwin编译ruby 2.0.0-p535。我安装并运行了cygwin。我编译了cygdrive / c / Source / ruby​​-2.0.0-p353。当尝试使用make函数编译文件时,我收到此错误。

compiling load.c
compiling proc.c
compiling file.c
file.c:4184:47: error: conflicting types for ‘GetLastError’
extern unsigned long __attribute__((stdcall)) GetLastError(void);
                                           ^
In file included from /usr/include/w32api/winbase.h:16:0,
             from /usr/include/w32api/windows.h:70,
             from file.c:18:
/usr/include/w32api/errhandlingapi.h:45:27: note: previous declaration of  ‘GetLastError’ was here
WINBASEAPI DWORD WINAPI GetLastError (VOID);
                       ^
Makefile:328: recipe for target 'file.o' failed
make: *** [file.o] Error 1

非常感谢任何帮助。如果有任何其他信息有用,请告诉我。

1 个答案:

答案 0 :(得分:1)

转到此目录/tmp/ruby-build.2013xxxx/ruby-your version /。你会找到源代码 修改以下内容:

--- /tmp/file.c 2014-05-13 15: 46: 16.129925200 +0900
+++ File.c 2014-05-13 15: 46: 56.862548100 +0900
@ @ @ @ -4126,7 Tasu4126,7

#ifdef __CYGWIN__
#include <winerror.h>
- extern unsigned long __attribute __ ((stdcall)) GetLastError (void); 
+ extern unsigned int __attribute __ ((stdcall)) GetLastError (void);
#endif

static VALUE

然后运行:

make install

为我工作。