The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]




Версия для распечатки Пред. тема | След. тема
Новые ответы [ Отслеживать ]
проблема с mysql, !*! Ser, 27-Май-01, 02:42  [смотреть все]
пытаюсьоткомпилить прогу:
#include <stdio.h>
#include <stdlib.h>
#include "mysql.h"
  MYSQL mysql;
  MYSQL_RES *res;
  MYSQL_ROW row;
  void exiterr(int exitcode)
  {
    //fprintf(stderr, "%s\n", mysql_error(&mysql));
    exit(exitcode);
  }
  int main()
  {
    uint i = 0;
    if (!(mysql_connect(&mysql,"127.0.0.1","root","")))
       exiterr(1);
    if (mysql_select_db(&mysql,"test")) exiterr(2);
    if (mysql_query(&mysql,"SELECT * FROM users"))
       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\n",row[i]);
    }
    if (!mysql_eof(res)) exiterr(5);
    mysql_free_result(res);
    mysql_close(&mysql);
  }

получаю:

[ser@ihg prog]$ cc mysql.c
/tmp/cchq4l2S.o: In function `main':
/tmp/cchq4l2S.o(.text+0x3e): undefined reference to `mysql_connect'
/tmp/cchq4l2S.o(.text+0x66): undefined reference to `mysql_select_db'
/tmp/cchq4l2S.o(.text+0x8e): undefined reference to `mysql_query'
/tmp/cchq4l2S.o(.text+0xb1): undefined reference to `mysql_store_result'
/tmp/cchq4l2S.o(.text+0xe0): undefined reference to `mysql_fetch_row'
/tmp/cchq4l2S.o(.text+0x111): undefined reference to `mysql_num_fields'
/tmp/cchq4l2S.o(.text+0x15c): undefined reference to `mysql_eof'
/tmp/cchq4l2S.o(.text+0x180): undefined reference to `mysql_free_result'
/tmp/cchq4l2S.o(.text+0x190): undefined reference to `mysql_close'
collect2: ld returned 1 exit status    




Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру