To administer your WestHost account, please enter your
Domain Name or Server Manager Username.

WestHost: Professional Website Hosting Company








Results 1 to 7 of 7
  1. #1
    Junior Member
    Join Date
    Dec 2003
    Posts
    19

    Default mysql link errors

    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

  2. #2
    Moderator wildjokerdesign's Avatar
    Join Date
    Jun 2003
    Location
    Kansas City Mo
    Posts
    5,683

    Default 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

  3. #3
    Junior Member
    Join Date
    Dec 2003
    Posts
    19

    Default

    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.

  4. #4
    Senior Member jalal's Avatar
    Join Date
    May 2003
    Location
    Germany
    Posts
    1,377

    Default

    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...

  5. #5
    Moderator wildjokerdesign's Avatar
    Join Date
    Jun 2003
    Location
    Kansas City Mo
    Posts
    5,683

    Default

    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

  6. #6
    Junior Member
    Join Date
    Dec 2003
    Posts
    19

    Default

    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.

  7. #7
    Junior Member
    Join Date
    Dec 2003
    Posts
    19

    Default

    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

  1. Unable to uninstall MySQL 3.23 nor upgrade to MySQL 5
    By lifelinesfoundation in forum PHP / MySQL
    Replies: 1
    Last Post: 07-02-2007, 07:18 AM
  2. Replies: 19
    Last Post: 04-05-2006, 04:42 PM
  3. MySQL Fresh Install - How To?
    By howard in forum PHP / MySQL
    Replies: 4
    Last Post: 04-24-2005, 04:37 PM
  4. connecting to mysql using mysqlcc
    By pinhead in forum PHP / MySQL
    Replies: 4
    Last Post: 03-11-2005, 09:23 PM
  5. Replies: 0
    Last Post: 12-18-2004, 09:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •