2013-11-26 151 views
1

我試着用編譯器cygwin編譯ruby 2.0.0-p535。我已經安裝並運行了cygwin。我編譯了cygdrive/c/Source/ruby​​-2.0.0-p353。當試圖使用make函數編譯文件時,我得到這個錯誤。cygwin編譯器編譯ruby file.c錯誤

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

轉至此目錄/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 

爲我工作。