maverick   6년 전

1924번 문제는 문제 분류로 for문을 이용하라고 되어있지만,

저는 이 문제를 zeller's congruence라는 방법을 이용하여 구현하였습니다.

문제는 이 코드가 온라인으로 제출했을 때는 컴파일 에러가 난다는 것입니다.

로컬에서 Visual Studio와 Cygwin gcc로 테스트 해 본 결과 문제없이 잘 돌아가는데 말이지요 ㅠㅠㅠ


컴파일러의 에러 메시지는 다음과 같습니다.

/tmp/Main-8d50a3.o: In function `ZellerCongruence':
Main.c:(.text+0x40): undefined reference to `ceil'
Main.c:(.text+0x65): undefined reference to `ceil'
Main.c:(.text+0x9b): undefined reference to `ceil'
Main.c:(.text+0xbe): undefined reference to `ceil'
/tmp/Main-8d50a3.o: In function `main':
Main.c:(.text+0x158): undefined reference to `ceil'
/tmp/Main-8d50a3.o:Main.c:(.text+0x17d): more undefined references to `ceil' follow
clang-5.0: error: linker command failed with exit code 1 (use -v to see invocation)


chogahui05   6년 전

c로 컴파일 하면 되네요.

clang의 경우는 -lm 옵션을 붙여줘야 합니다.

maverick   6년 전

확인했습니다. 붙는 옵션이 다른 것을 미쳐 확인하지 못했네요.
감사합니다. ^^

댓글을 작성하려면 로그인해야 합니다.