Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6137745
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:45:54+00:00 2026-05-23T17:45:54+00:00

i’ve been trying to link mysql with c++ below is the code for ref

  • 0

i’ve been trying to link mysql with c++ below is the code for ref

the file called sqlfunction.cpp has following code which helps connect mysql

#include <mysql.h>
#include "rlmodbusclient.h"
#include "modbusdaemon.h"

MYSQL *conn;
MYSQL_RES *res;
MYSQL_ROW row;

bool Opendb(char *pc,char *user, char *pass, char *db)
{

    conn = mysql_init(NULL);
   // Connect to database

   if (!mysql_real_connect(conn, pc,
   user, pass, db, 0, NULL, 0)) {
   fprintf(stderr, "%s\n", mysql_error(conn));
   return 0;
   } else return 1;

}

now if above called from the program files like this

char pc[10]="localhost",user[5]="root",pass[8]="pass",db[6]="database";

   ret = Opendb(pc,user,pass,db);
   printf("opendb_buttonevent = %d\n",ret);

this is all good but the only thing is program is not compiling at all

the error is
undefined reference to mysql_init@4′

i found one solution for this which is

http://www.openwebspider.org/documentation/how-to-link-libmysqllib-with-dev-c-or-gcc-under-windows/

this link suggest to run reimp.exe with libmysql.lib

i tried to run this but this doesnt make any sense please if some one has done above then explain how to use reimp to solve this issue..

thanks

just like to add command which i’m using to run reimp

C:\Documents and Settings\XPMUser\Desktop\mingwutils\bin>reimp.exe "C:\Program F
iles\MySQL\MySQL Server 5.5\lib\libmysql.lib"
reimp.exe: dlltool: No such file or directory

as can be seen it says dlltool: no such file but i found that dlltool is part of
C:\MinGW\bin directory… which doesnt make any sense?????

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:45:55+00:00Added an answer on May 23, 2026 at 5:45 pm

    The general problem is that the libmysql.lib library is in the Microsoft-specific lib format, which mingw cannot link against. It seems that reimp.exe can convert such libraries and needs dlltool to do so. It probably couldn’t find it because it is not in your PATH. Try

    set PATH=%PATH%;C:\MinGW\bin
    reimp.exe “C:\Program Files\MySQL\MySQL Server 5.5\lib\libmysql.lib”

    Afterwards, you should gain a libmysql.a file, which must be moved somewhere the mingw linker can find it, e.g. your project directory.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a jquery bug and I've been looking for hours now, I can't
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.