I'm compiling/linking a C application and getting link errors. This app has been tested/compiled/linked on mylocal machine and runs fine. The app will loginto my db, peform some queries, and send an email alert to users of my website.
I'm assuming the path to mysql/lib is correct, but I have no access to that directory. Any help is appreciated. (live chat seems to be dead). The errors are as follows...
west48:~/db$ gcc -c -I/usr/local/mysql/include ADSendAlert.c
west48:~/db$ gcc -o ADSendAlert ADSendAlert.o -L/usr/local/mysql/lib -lmysqlclient -lz
ADSendAlert.o: In function `main':
ADSendAlert.o(.text+0xfb): undefined reference to `mysql_error'
ADSendAlert.o(.text+0x10c): undefined reference to `mysql_errno'
ADSendAlert.o(.text+0x193): undefined reference to `mysql_error'
ADSendAlert.o(.text+0x1a4): undefined reference to `mysql_errno'
ADSendAlert.o(.text+0x1f6): undefined reference to `mysql_error'
ADSendAlert.o(.text+0x207): undefined reference to `mysql_errno'
ADSendAlert.o(.text+0x2c9): undefined reference to `mysql_error'
ADSendAlert.o(.text+0x2da): undefined reference to `mysql_errno'
ADSendAlert.o(.text+0x327): undefined reference to `mysql_error'
ADSendAlert.o(.text+0x338): undefined reference to `mysql_errno'
ADSendAlert.o(.text+0x547): undefined reference to `mysql_errno'
ADSendAlert.o(.text+0x55b): undefined reference to `mysql_error'
ADSendAlert.o(.text+0x56c): undefined reference to `mysql_errno'
ADSendAlert.o(.text+0x598): undefined reference to `mysql_num_rows'
collect2: ld returned 1 exit status
Results 1 to 7 of 7
Thread: mysql link errors
-
12-02-2003, 10:02 PM #1Junior Member
- Join Date
- Dec 2003
- Posts
- 19
mysql link errors
-
12-03-2003, 09:03 AM #2
More Info
Not sure what the program is doing but do know you need MySQL installed first via the SiteManager to use msysql and that the database needs to be on the server. I can't tell but it looks like your errors are coming from the program and not the server right?
To run php with mysql you allso have to install the phpmysl libs so there may be something like that for C also.
If your setup is like others in /usr/local/mysql/lib there is a mysql sym link to /ftp/usr/lib/mysql . Why do you not have access to that directory? You should. How did you install the program on your server? Or are you trying to connect to the database on your server from your local machine? Sorry for all the questions but not real clear what you are trying to do so hard to figure out what the answer may be.
P.S. I know nothing about C so not sure how much help I can be but other users do and with more info may be able to help.Shawn
Please remember your charity of choice: http://www.redcross.org
Handy Links: wildjokerdesign.net | Plain Text Editors: EditPlus | Crimson
-
12-03-2003, 10:26 AM #3Junior Member
- Join Date
- Dec 2003
- Posts
- 19
Thanks for your reply,
I don't have a dedicated server. Mysql and php were installed by Westhost. Both are installed as my php scripts work just fine. The php scripts also access mysql.
Yes the errors are from the linker, not the server, as it tries linking with the mysqlclient. I'm hoping someone else has tried compiling/linking a C app.
I couldn't follow the link from /usr/local/mysql/ although it is a symbolic link. I assumed that the c api libraries would be installed there, and I assumed that since I couldn't access the ./lib dir that the libraries for mysqlclient were residing elsewhere.
-
12-03-2003, 12:41 PM #4
You may want to try linking to the real location of the libraries at:
/lib/mysql/
Maybe the linker doesn't want to follow the links...
-
12-03-2003, 01:06 PM #5
Are you on WestHost 1.0 or 2.0?
Shawn
Please remember your charity of choice: http://www.redcross.org
Handy Links: wildjokerdesign.net | Plain Text Editors: EditPlus | Crimson
-
12-03-2003, 03:16 PM #6Junior Member
- Join Date
- Dec 2003
- Posts
- 19
Jalal,
I'll try your link suggestion. I'm guessing either the path is wrong or the libraries are just missing.
wildjokerdesign,
I'm still on WH 1.0, they gave up on 2.0 and have yet to convert my sites.
Odd thing is that I'm sure I ran into this problem before on my local box...I think the solution was to upgrade mysql??? If I can only recall. Thanks for you thoughts.
-
12-03-2003, 03:28 PM #7Junior Member
- Join Date
- Dec 2003
- Posts
- 19
FYI,
I found an explanation from mysql.com (http://www.mysql.com/doc/en/Link_errors.html), they recomend the following:
you should be able to solve this by adding -Lpath-to-the-mysql-library -lmysqlclient last on your link line.
But since I already added that, the path itself must be incorrect. I'll play with it some more.
Similar Threads
-
Unable to uninstall MySQL 3.23 nor upgrade to MySQL 5
By lifelinesfoundation in forum PHP / MySQLReplies: 1Last Post: 07-02-2007, 07:18 AM -
How to upgrade MySQL from version 3.x to 4.x w/o Root access
By webgraph in forum PHP / MySQLReplies: 19Last Post: 04-05-2006, 04:42 PM -
MySQL Fresh Install - How To?
By howard in forum PHP / MySQLReplies: 4Last Post: 04-24-2005, 04:37 PM -
connecting to mysql using mysqlcc
By pinhead in forum PHP / MySQLReplies: 4Last Post: 03-11-2005, 09:23 PM -
Mysql 4.0.20 + php 5.0.2 installed on a VPS and working
By ssever in forum PHP / MySQLReplies: 0Last Post: 12-18-2004, 09:34 AM
Reply With Quote