我的一个朋友查看了我的代码并提出了一些改进建议。这些建议应该可行,而且我们已经解决了代码本身的所有错误,但是在尝试编译一个基本的 int main() 时,它会引发一堆关于其自身库中某些内容的错误。唯一改变的是我们细化了代码,以减少重复的语句,并且还使用布尔值而不是其他东西。
这是现在的代码:http: //pastebin.com/nG0Dr4h0
以下是错误:
E:\Utils\compile\files>gcc -Werror -Wall leapYear.c leapYear.exe
leapYear.exe:crt1.c:(.text+0x280): multiple definition of `mainCRTStartup'
e:/utils/compile/c/gcc/bin/../lib/gcc/mingw32/4.7.1/../../../crt2.o:crt1.c:(.text+0x280): first defined here
leapYear.exe:crt1.c:(.text+0x2a0): multiple definition of `WinMainCRTStartup'
e:/utils/compile/c/gcc/bin/../lib/gcc/mingw32/4.7.1/../../../crt2.o:crt1.c:(.text+0x2a0): first defined here
leapYear.exe:crt1.c:(.text+0x2c0): multiple definition of `atexit'
e:/utils/compile/c/gcc/bin/../lib/gcc/mingw32/4.7.1/../../../crt2.o:crt1.c:(.text+0x2c0): first defined here
leapYear.exe:crt1.c:(.text+0x2d0): multiple definition of `_onexit'
e:/utils/compile/c/gcc/bin/../lib/gcc/mingw32/4.7.1/../../../crt2.o:crt1.c:(.text+0x2d0): first defined here
leapYear.exe:cygming-crtbegin.c:(.text+0x2e0): multiple definition of `__gcc_register_frame'
e:/utils/compile/c/gcc/bin/../lib/gcc/mingw32/4.7.1/crtbegin.o:cygming-crtbegin.c:(.text+0x0): first defined here
leapYear.exe:cygming-crtbegin.c:(.text+0x32c): multiple definition of `__gcc_deregister_frame'
e:/utils/compile/c/gcc/bin/../lib/gcc/mingw32/4.7.1/crtbegin.o:cygming-crtbegin.c:(.text+0x4c): first defined here
leapYear.exe:leapYear.c:(.text+0x334): multiple definition of `main'
C:\Users\[REDACTED]\AppData\Local\Temp\ccKNWKLb.o:leapYear.c:(.text+0x72): first defined here
leapYear.exe:crt1.c:(.bss+0x4): multiple definition of `_argc'
e:/utils/compile/c/gcc/bin/../lib/gcc/mingw32/4.7.1/../../../crt2.o:crt1.c:(.bss+0x4): first defined here
leapYear.exe:crt1.c:(.bss+0x0): multiple definition of `_argv'
e:/utils/compile/c/gcc/bin/../lib/gcc/mingw32/4.7.1/../../../crt2.o:crt1.c:(.bss+0x0): first defined here
e:/utils/compile/c/gcc/bin/../lib/gcc/mingw32/4.7.1/crtbegin.o:cygming-crtbegin.c:(.text+0x45): undefined reference to `_Jv_RegisterClasses'
collect2.exe: error: ld returned 1 exit status