Change libmysql. dll of MySQL to libmysql. A under Dev-C ++.

Source: Internet
Author: User

Http://16hot.blog.isyi.com/post/1/144

Search for some materials online and follow the prompts above.

The problem has been solved.

Because I am using Dev-C ++ development tools. It uses the GCC compiler.

The windows for C Connection Library provided by MySQL does not support GCC, cygwin, and mingw.

Therefore, when compiling the connection, an error message is displayed.

Solution:

1. Install MySQL (if you do not want to install it, you can find a libmysql. dll file)

2. Download The pexports Tool

3. Conversion operation: pexports libmysql. dll> libmysql. Def

4. Use cygwin's dlltool to convert it to the libmysql. A file. Dlltool -- input-Def libmysql. def -- dllname libmysql. dll -- output-lib libmysql. A-K

5. Check whether the attempt is successful: gcc-O mysqldemo. O <path to libmysql. A>

If the following error message is displayed: mysql_connect @ XX (XX is a number. Perform step 1.

6. Modify the libmysql. Def file and add @ XX to mysql_connect, that is, mysql_connect @ xx.

7. Redo Step 1

8. Then, try Step 1. If the error still persists. Step 2. Until there is no error.

7 Comments on "Solving the Problem of connecting C to MySQL in Windows"
  1. Author16hotHow did you compile it? [Reply]
    04/11/2005, 23:51

     

    How did you compile it?

     

  2. Author16hotProcedure [reply]
    05/11/2005, 17: 32

     

    Step 1: Specify the path of MySQL. h and other files
    In Dev-C ++, open the project, and ALT + P open the project properties.
    Add the path for storing the MySQL header file in "file/directory"> "include file directory.

    Step 2: generate the libmysql. A file
    Refer to my aboveArticleThe compiler must convert libmysql. DLL to libmysql..
    Because libmysql. dll provided by MySQL is used by Microsoft Vc ++. :(
    I have been doing this for a long time.

    Step 3: Specify the path of libmysql.
    It is also in project properties. On the "Parameters" page, there is a "connector" box. Click "add to database or object" below, open it, go to the directory where you store the libmysql. A file, and select it.
    Then exit the Properties window and compile.

    At this time, some function prompts will appear, such as mysql_query @ 8 does not exist. You need to refer to the above article and change it step by step to generate a new libmysql. A file.
    Until successful.

     

  3. prepared by lewbing [reply]
    11/05/2006,

    16hot brother: Thank you very much. I have been searching for this information for a long time. Because I hate using pirated software, I use free software instead of pirated software whenever possible. So I also use DEV-CPP instead of Visual C ++, but DEV-CPP use information is really scarce, help documentation is not detailed enough. Free Software. How can I do this well? But thank you very much.
    I want to write some articles on the usage methods and skills of some commonly used software development software with few materials in China. I hope we can talk about it later, and I will leave my Gmail mailbox, please mail me your time. We will talk about it later !!!
    Email: lewbing@gmail.com

  4. AuthorKennyQuestion about libmysql. A [reply]

     

    Hello
    I have found many articles on the Internet ~ Finally, I can see this article
    So I took your approach ~ Produced libmysql.
    But when I link it, there will still be a problem...
    [Linker Error] undefined reference to 'mysql _ init @ 4'
    [Linker Error] undefined reference to 'mysql _ real_connect @ 32'
    [Linker Error] undefined reference to 'mysql _ query @ 8'
    [Linker Error] undefined reference to 'mysql _ close @ 4'

    My IDE is DEV-C ++ 4.9.9.2
    MySQL is 5.0.27
    Have you ever encountered this problem?

     

  5. Author16hotModify the libmysql. Def file [reply]

     

    Modify the libmysql. Def file, add all functions that are not prompted, and then perform steps 4th and 5. If there are still, repeat until there is no prompt.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.