#need help in leap year programming in c
1 messages · Page 1 of 1 (latest)
What do you need help with? Is a test failing? If so, which one and what's the message?
Could you please edit your post to add codeblocks around your code (and the error message)?
this is what's showing
We received the following error when we ran your code:
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/ccEkAgCI.o: in function main': /mnt/exercism-iteration/./test_leap.c:59: multiple definition of main'; /tmp/ccLDMnGE.o:/mnt/exercism-iteration/./leap.c:5: first defined here
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/ccEkAgCI.o: in function test_year_not_divisible_by_4_in_common_year': /mnt/exercism-iteration/./test_leap.c:14:(.text+0x18): undefined reference to leap_year'
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/ccEkAgCI.o: in function test_year_divisible_by_2_not_divisible_by_4_in_common_year': /mnt/exercism-iteration/./test_leap.c:19:(.text+0x44): undefined reference to leap_year'
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/ccEkAgCI.o: in function test_year_divisible_by_4_not_divisible_by_100_in_leap_year': /mnt/exercism-iteration/./test_leap.c:24:(.text+0x70): undefined reference to leap_year'
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/ccEkAgCI.o: in function test_year_divisible_by_4_and_5_is_still_a_leap_year': /mnt/exercism-iteration/./test_leap.c:29:(.text+0x99): undefined reference to leap_year'
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/ccEkAgCI.o: in function test_year_divisible_by_100_not_divisible_by_400_in_common_year': /mnt/exercism-iteration/./test_leap.c:34:(.text+0xc2): undefined reference to leap_year'
/usr/lib/gcc/x86_64-alpine-linux-musl/14.2.0/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/ccEkAgCI.o:/mnt/exercism-iteration/./test_leap.c:40: more undefined references to `leap_year' follow
collect2: error: ld returned 1 exit status
make: *** [makefile:37: tests.out] Error 1
Did you edit the header?
Ignore the long file paths in the error messages and you’ll see a pattern in what the test runner is telling you. What’s the most common message? Do you understand what it means?
Yes In first part it's saying multiple iteration of main
But how should I proceed now?
The crux of the error is undefined reference to 'leap_year'
You need to declare that function in the header
Ok. Will try
i dont understand the leap year program what they want we do