Mysql

This is a discussion on Mysql within the C++ Programming forums, part of the General Programming Boards category; Location: Posts: 1 libaries 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 ...

  1. #1
    Registered User
    Join Date
    Oct 2003
    Posts
    1

    libraries

    Location:
    Posts: 1
    libaries
    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:

    C:\DEV-C++\Lib\;C:\mysql\lib\opt\

    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.

    Thanks.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,765
    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.
    << !! Posting Code? Read this First !! >>

    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
    Code:
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Change detection in MySQL.
    By amitbora27 in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 05-13-2009, 11:34 AM
  2. MySQL libraries
    By csonx_p in forum C++ Programming
    Replies: 6
    Last Post: 10-02-2008, 03: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, 01: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, 02:25 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21