>> Read No. 31366 article  
mysql.h 파일을 사용해서 리눅스 프로그래밍 해보신

등록 2001-05-25 15:56:00     조회 2
이름 김명수    

		#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <assert.h>
#include <termios.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <mysql/mysql.h>
 MYSQL mysql;
MYSQL_RES *res;
MYSQL_ROW row;
 char host<>="localhost";
char user<>="root";
char passwd<>="dmswn^^audtn";
 void exiterr(int exitcode)
{
        fprintf(stderr, "%s", mysql_error(&mysql));
        exit(exitcode);
}
 int main(void)
{
        int i=0;
        if(!(mysql_connect(&mysql, host, user, passwd)))
        exiterr(1);
        if(mysql_select_db(&mysql, "mysql"))
        exiterr(2);
        if(mysql_query(&mysql, "SELECT * FROM db"))
        exiterr(3);
        if(!(res=mysql_store_result(&mysql)))
        exiterr(4);
        while((row=mysql_fetch_row(res)))
        {
                for(i=0; i< mysql_num_fields(res); i++)
                printf("%s", row[i]);
        }
        if(!mysql_eof(res))
        exiterr(5);
        mysql_free_result(res);
        mysql_close(&mysql);
        return 0;
}
 이것을 컴파일하면 아래와 같은 에러가 납니다...
 /tmp/cccm1gy0.o: In function `exiterr':
/tmp/cccm1gy0.o(.text+0x12): undefined reference to `mysql_error'
/tmp/cccm1gy0.o: In function `main':
/tmp/cccm1gy0.o(.text+0x5e): undefined reference to `mysql_connect'
/tmp/cccm1gy0.o(.text+0x86): undefined reference to `mysql_select_db'
/tmp/cccm1gy0.o(.text+0xae): undefined reference to `mysql_query'
/tmp/cccm1gy0.o(.text+0xd1): undefined reference to
`mysql_store_result'
/tmp/cccm1gy0.o(.text+0x102): undefined reference to `mysql_fetch_row'
/tmp/cccm1gy0.o(.text+0x12e): undefined reference to `mysql_num_fields'
/tmp/cccm1gy0.o(.text+0x172): undefined reference to `mysql_eof'
/tmp/cccm1gy0.o(.text+0x196): undefined reference to
`mysql_free_result'
/tmp/cccm1gy0.o(.text+0x1a6): undefined reference to `mysql_close'
collect2: ld returned 1 exit status
 뭐가 문제인지 몰르겠습니다...
다른 것을 설치 해야되나엽....
고수님 잘 가르쳐 주세요
이름
암호


>> 관련글
31366 mysql.h 파일을 사용해서 리눅스 프로그래밍 해보신분  김명수  2001.05.25  ....
  답장 RE: mysql.h 파일을 사용해서 리눅스 프로그래밍 해보신분  진인사대컴명  2001.05.25  ....
Register [ localhost 목록보기 윗글 아랫글
글쓰기
답장쓰기 수정 삭제
정규표현식 [ 상세 검색 ]
페이지로딩: [ 1.82 초 ] 작업시간: [ 0.65 초 ]

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

적수네 동네
+
| 적수네 동네
| 공부방
| 리눅스 잡지 서고
| LSN 소스
| 링크 모음
+---+
게시판
+
| 떠들어보세!
| 질문과 답변
| 새소식과 정보
| 1원짜리 팁?
| 대화방
+---+
칼럼?
+
| 세하 훔쳐보기
| Welcome2nite
| 혜진의 염장판
+---+
리눅스 상표권
+
| 반대 서명란
| 토론 게시판
+---+
GNU
+
| GNU 선언문
| GNU GPL
| GNU 미러 목록
+---+
프로젝트?
+
| 리눅스카운터
| RC5DES
| 실질헌법 제작
+---+
커널 소식
+
| 안정 버젼: 2.4.14
+---+
테마 선택
+
LSN 방송국?
+
| OFF AIR
+---+
회원
+
| 로그인
+---+
[ 적수네 동네 ] [ 리눅스 상표권 독점 반대 ] [ 한글 리눅스 문서 프로젝트 ] [ KrLine ] [ 사랑넷 ] [ Valid HTML 4.0! ] [ SlashDot ] [ Freshmeat ]
Copyleft (C) 1998-2001 Byeong-Chan Kim . License
TIME: 1789538045
System by WYZsoft, HDD by I.O.Linux, Mizi Research, Embryo, WOWLINUX, Domain by SarangNet, Network by KrLine.