>> Delete Reply from No. 43435 article
No. RE: gcc에서 sqrt가 실행이 안됩니다.

등록 2002-02-28 12:58:00 By localhost     조회 2
이름 이정현    

		: #include <stdio.h>
: #include <math.h>
:
: void main() {
:     printf ("%1.8f", sqrt((double)2));
: }
:
: gcc test.c 를 실행하면 다음과 같은 메세지가 나옵니다.
:
: test.c: In function `main':
: test.c:4: warning: return type of `main' is not `int'
: /var/tmp/ccwfDoBO.o: In function `main':
: /var/tmp/ccwfDoBO.o(.text+0x24): undefined reference to `sqrt'
: collect2: ld returned 1 exit status
:
: 왜 이런 현상이 나오는거지요?
: 분명 math.h에는 sqrt가 define되어 있는데 말입니다.
: 좀 도와주세요. 그럼이만.
 gcc test.c -lm
math 라이브러리를 컴팔할때 링크 시켜야 합니다.
[관리자] 패스워드를 입력 하십시오. 답장이 존재하면 함께 삭제됩니다.[ 목록 | 이전 ]
패스워드:    

Copyleft 1999-2026 by JSBoard Open Project
Theme Designed by IDOO All right reserved