Thread: Mysql

  1. #1
    Registered User
    Join Date
    Oct 2003


    Posts: 1
    I am getting this error:

    c:\windows\TEMP\cc92DHQa.o(.text+0x30):untitl~1.cp p: undefined reference to `mysql_close@4'

    I can't figure out where to add in the library for linking - or else I am doing it right, but the solution listed above is not working. I am using bloodshed dev 4.0 on a windows machine.

    This is what I am doing from my C++ program:
    Options ---> Compiler Options

    I am adding ";C:\mysql\lib\opt\" to the Libraries directory:


    I have also tried moving everything from the opt folder into DEC-C++\Lib ... no luck. Same error message.

    Any ideas? I am new and am unfamiliar with the linking process.


  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Since I can't PM you, I'll remind you of the rules here.

    Bumping old threads with a related problem is not allowed, so I've split your message off into a new thread.

    Oh, and I've deleted your other thread as you requested.

    Given that mysql is the 'C' API and mysql++ is the 'C++' API, I'd say you've got some kind of mis-match.

    The problem is, the compiler has turned the C name mysql_close() into it's C++ equivalent, and obviously this doesn't exist.

    I'd try
    extern "C" { 
    #include <mysql.h>
    To force the C++ compiler to treat the SQL header file as C (though this should be done inside the header)
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Change detection in MySQL.
    By amitbora27 in forum A Brief History of
    Replies: 2
    Last Post: 05-13-2009, 10:34 AM
  2. MySQL libraries
    By csonx_p in forum C++ Programming
    Replies: 6
    Last Post: 10-02-2008, 02:23 AM
  3. About C++ and MySQL or oether free database
    By xxxrugby in forum C++ Programming
    Replies: 18
    Last Post: 12-30-2005, 06:28 AM
  4. Get data from mysql and use in a system.
    By smaakage in forum Tech Board
    Replies: 3
    Last Post: 10-04-2005, 12:03 PM
  5. Get data from mysql and use in a system.
    By smaakage in forum C++ Programming
    Replies: 5
    Last Post: 10-02-2005, 01:25 PM