Re: C API: undefined reference

2003-11-12 Thread hAj
Thanx so much! mysql_real_connect() certainly works.

Best,
hAj

on 2003.11.11 17:55, Nick Gaugler at [EMAIL PROTECTED] wrote:

 http://www.mysql.com/doc/en/mysql_connect.html
 
 This function is deprecated. It is preferable to use
 mysql_real_connect() instead.
 
 
 
 #includestdio.h
 #includemysql.h
 
 int main(void) {
 MYSQL mysql;
 
 if(mysql_init(mysql) == NULL) {
 fprintf(stderr,Unable to initlize MySQL structure.\n);
 return(1);
 }
 
 if(mysql_real_connect(mysql,127.0.0.1,user,password, db, 0,
 NULL, 0) == NULL) {
 fprintf(stderr,Unable to connect to MySQL: %s\n,
 mysql_error(mysql));
 return(1);
 }
 
 return(0);
 }
 
 
 mybox:/home/nickgsu  gcc seeLog.c -o seeLog -I/usr/local/mysql/include
 -L/usr/local/mysql/lib -lmysqlclient -lz
 mybox:/home/nickgsu  ./seeLog
 Unable to connect to MySQL: Access denied for user: '[EMAIL PROTECTED]'
 (Using password: YES)
 
 
 
 
 Good luck,
 
 
 nickg
 
 
 -Original Message-
 From: hAj [mailto:[EMAIL PROTECTED]
 Sent: Monday, November 10, 2003 4:03 PM
 To: [EMAIL PROTECTED]
 Subject: C API: undefined reference
 
 Hello MySQL pros worldwide,
 
 
 ~/www -cat seeLog.c
 #define USE_OLD_FUNCTIONS
 #include stdio.h
 #include mysql/mysql.h
 
 int main() {
 MYSQL mysql;
 MYSQL *mysqldb = NULL;
 
 mysqldb = mysql_connect(mysql, geneofcube.net, USERID,
 PASSWORD);
 
 return 0;
 }
 ~/www -gcc seeLog.c -o seeLog -I/usr/include -L/usr/lib -lmysqlclient
 /tmp/ccEj3tmv.o: In function `main':
 /tmp/ccEj3tmv.o(.text+0x2a): undefined reference to `mysql_connect'
 collect2: ld returned 1 exit status
 ~/www -
 
 
 As shown above, I'm having a problem getting rid of a compilation error
 (undefined reference) coming out with a very simple c code (seeLog.c)
 which
 I wrote for a testing purpose.
 Got no I idea what I'm doing wrong or missing here.
 
 I'd appreciate any of your suggestions.
 
 
 Best,
 hAj
 


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: C API: undefined reference

2003-11-11 Thread Nick Gaugler
http://www.mysql.com/doc/en/mysql_connect.html

This function is deprecated. It is preferable to use
mysql_real_connect() instead.



#includestdio.h
#includemysql.h

int main(void) {
MYSQL mysql;

if(mysql_init(mysql) == NULL) { 
fprintf(stderr,Unable to initlize MySQL structure.\n);
return(1);
}

if(mysql_real_connect(mysql,127.0.0.1,user,password, db, 0,
NULL, 0) == NULL) { 
fprintf(stderr,Unable to connect to MySQL: %s\n,
mysql_error(mysql));
return(1);
}

return(0);
}


mybox:/home/nickgsu  gcc seeLog.c -o seeLog -I/usr/local/mysql/include
-L/usr/local/mysql/lib -lmysqlclient -lz
mybox:/home/nickgsu  ./seeLog 
Unable to connect to MySQL: Access denied for user: '[EMAIL PROTECTED]'
(Using password: YES)




Good luck,


nickg


-Original Message-
From: hAj [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 10, 2003 4:03 PM
To: [EMAIL PROTECTED]
Subject: C API: undefined reference

Hello MySQL pros worldwide,


~/www -cat seeLog.c
#define USE_OLD_FUNCTIONS
#include stdio.h
#include mysql/mysql.h

int main() {
MYSQL mysql;
MYSQL *mysqldb = NULL;

mysqldb = mysql_connect(mysql, geneofcube.net, USERID,
PASSWORD);

return 0;
}
~/www -gcc seeLog.c -o seeLog -I/usr/include -L/usr/lib -lmysqlclient
/tmp/ccEj3tmv.o: In function `main':
/tmp/ccEj3tmv.o(.text+0x2a): undefined reference to `mysql_connect'
collect2: ld returned 1 exit status
~/www -


As shown above, I'm having a problem getting rid of a compilation error
(undefined reference) coming out with a very simple c code (seeLog.c)
which
I wrote for a testing purpose.
Got no I idea what I'm doing wrong or missing here.

I'd appreciate any of your suggestions.


Best,
hAj


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/[EMAIL PROTECTED]


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: C API: undefined reference

2003-11-11 Thread Aftab Jahan Subedar
alright. looking at your directory this should be ok.

gcc seeLog.c -o seeLog -I/usr/include -L/usr/lib/mysql -lmysqlclient
;)
Aftab Jahan Subedar
Subedar Technologies
Subedar Baag
Bibir Bagicha #1
North Jatrabari
Dhaka 1204
Bangladesh
sms://+447765341890
tel://+88027519050
[EMAIL PROTECTED]
http://www.DhakaStockExchangeGame.com/
hAj wrote:
Hello Jahan,

on 2003.11.11 07:43, Aftab Jahan Subedar at [EMAIL PROTECTED] wrote:


use the following options to compile

gcc seeLog.c -o seeLog -I/usr/local/include -L/usr/local/lib/mysql
-lmysqlclient
Strangely, your options and mine came out with the same error:
The first is yours and 2nd is mine.
~/www -gcc seeLog.c -o seeLog -I/usr/local/include -L/usr/local/lib/mysql
-lmysqlclient
/tmp/ccuX7I5J.o: In function `main':
/tmp/ccuX7I5J.o(.text+0x2a): undefined reference to `mysql_connect'
collect2: ld returned 1 exit status
~/www -gcc seeLog.c -o seeLog -I/usr/include -L/usr/lib -lmysqlclient
/tmp/ccZxcaCR.o: In function `main':
/tmp/ccZxcaCR.o(.text+0x2a): undefined reference to `mysql_connect'
collect2: ld returned 1 exit status
What does this undefined reference really imply, that the lib binary is
broken ?
Below is to show you where the .h and lib file I need are located on this
particular system I'm trying to run the thing:
~/www -find / -name '*mysql.h*' 2-
/home/temp/installd/buildapache/php-4.3.3/ext/dbx/dbx_mysql.h
/home/temp/installd/buildapache/php-4.3.3/ext/mysql/libmysql/mysql.h
/home/temp/installd/buildapache/php-4.3.3/ext/mysql/php_mysql.h
/home/cpapachebuild/buildapache/php-4.3.3/ext/dbx/dbx_mysql.h
/home/cpapachebuild/buildapache/php-4.3.3/ext/mysql/libmysql/mysql.h
/home/cpapachebuild/buildapache/php-4.3.3/ext/mysql/php_mysql.h
/usr/include/mysql/mysql.h
~/www -find / -name '*mysqlclient*' 2-
/usr/lib/mysql/libmysqlclient.a
/usr/lib/mysql/libmysqlclient.la
/usr/lib/mysql/libmysqlclient_r.a
/usr/lib/mysql/libmysqlclient_r.la
/usr/lib/libmysqlclient.so
/usr/lib/libmysqlclient.so.12
/usr/lib/libmysqlclient.so.12.0.0
/usr/lib/libmysqlclient_r.so
/usr/lib/libmysqlclient_r.so.12
/usr/lib/libmysqlclient_r.so.12.0.0
/usr/lib/libmysqlclient.so.10
/usr/lib/libmysqlclient.so.10.0.0
/usr/lib/libmysqlclient_r.so.10
/usr/lib/libmysqlclient_r.so.10.0.0
/usr/lib/libmysqlclient.so.9
/usr/lib/libmysqlclient.so.6


Best,
hAj



Aftab Jahan Subedar
Subedar Technologies
Subedar Baag
Bibir Bagicha #1
North Jatrabari
Dhaka 1204
Bangladesh
sms://+447765341890
tel://+88027519050
[EMAIL PROTECTED]
http://www.DhakaStockExchangeGame.com/
hAj wrote:

Hello MySQL pros worldwide,

~/www -cat seeLog.c
#define USE_OLD_FUNCTIONS
#include stdio.h
#include mysql/mysql.h
int main() {
MYSQL mysql;
MYSQL *mysqldb = NULL;
mysqldb = mysql_connect(mysql, geneofcube.net, USERID,
PASSWORD);
return 0;
}
~/www -gcc seeLog.c -o seeLog -I/usr/include -L/usr/lib -lmysqlclient
use the following options to compile
-I/usr/local/include -L/usr/local/lib/mysql -lmysqlclient
jahan



/tmp/ccEj3tmv.o: In function `main':
/tmp/ccEj3tmv.o(.text+0x2a): undefined reference to `mysql_connect'
collect2: ld returned 1 exit status
~/www -
As shown above, I'm having a problem getting rid of a compilation error
(undefined reference) coming out with a very simple c code (seeLog.c) which
I wrote for a testing purpose.
Got no I idea what I'm doing wrong or missing here.
I'd appreciate any of your suggestions.

Best,
hAj










--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]