Mail Archives: djgpp/2002/07/18/00:26:04
From: | "John Montgomery" <john AT jmnospammp DOT demon DOT co DOT uk>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Connecting to MySql??
|
Date: | Thu, 18 Jul 2002 04:23:36 +0100
|
Message-ID: | <1026963446.12485.0.nnrp-14.c2dec317@news.demon.co.uk>
|
NNTP-Posting-Host: | jmmp.demon.co.uk
|
X-NNTP-Posting-Host: | jmmp.demon.co.uk:194.222.195.23
|
X-Trace: | news.demon.co.uk 1026963446 nnrp-14:12485 NO-IDENT jmmp.demon.co.uk:194.222.195.23
|
X-Complaints-To: | abuse AT demon DOT net
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 5.00.2314.1300
|
X-MimeOLE: | Produced By Microsoft MimeOLE V5.00.2314.1300
|
Lines: | 53
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Hi
I have mysql server installed, such that, for example it is working with
PHP/apache - thus it works.
However, I cannot get a connection from the following simple "client"
program:
#include "mysql.h"
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
MYSQL mysql;
void exiterr(int exitcode)
{
fprintf( stderr, "%s\n", mysql_error(&mysql) );
exit( exitcode );
}
int main()
{
if (!(mysql_connect(&mysql,"host","username","password")))
exiterr(1);
if (mysql_select_db(&mysql,"payroll"))
exiterr(2);
printf("\n\nEverything seems to be OK if I get to here.\n\n");
while(!kbhit());
} /*main*/
Compiled with various versions of the line:-
gcc -Ic:/mysql/include -Lc:/mysql/lib/debug isok.cpp -lmysqlclient
I get "undefined reference to" ... mysql_error, mysql_connect, and
mysql_select_db
I have renamed mysqlclient.lib to libmysqlclient.a to accomodate what -l
does, so it's not that - it finds the library file (I think). So I'm
beginning to think that mysqlclient.lib is in an incompatible format.
I have also tried including windows.h (from CBuilder3 includes) to no
avail - I get "redefinition" errors conflicting with mysql.h
I would be most greatful if someone give me pointers on how to set things up
correctly, please.
:-)
John Montgomery
- Raw text -