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 7777041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:02:18+00:00 2026-06-01T18:02:18+00:00

i want to connect C to mysql using the following code: #include <C:\Program Files\MySQL\MySQL

  • 0

i want to connect C to mysql using the following code:

#include <C:\Program Files\MySQL\MySQL Connector C 6.0.2\include\my_global.h>
#include <C:\Program Files\MySQL\MySQL Connector C 6.0.2\include\mysql.h>

#include <stdio.h> 
MYSQL *conn;    /* pointer to connection handler */

int main ( int argc, char *argv[] )
{
    conn = mysql_init ( NULL );
    mysql_real_connect (
            conn,"localhost","root","","operator", 3306, NULL,0 );        
    mysql_close ( conn );
    return 0;
}

When i try to compile ,i get:

Error   3   error LNK2019: unresolved external symbol _mysql_real_connect@32 referenced in function _main   C:\Users\kristel\Documents\Visual Studio 2010\Projects\database\database\database.obj   database

Error   4   error LNK2019: unresolved external symbol _mysql_init@4 referenced in function _main    C:\Users\kristel\Documents\Visual Studio 2010\Projects\database\database\database.obj   database

It seems like something is missing but i dont know when.

enter image description here

I have added the mysqllib.lib like in the picture but still the problem is not resolved.

Just another question: Doing my searches,i have found something concerning cmake.Is there any relation between my error and cmake?
Thank you.

  • 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-06-01T18:02:21+00:00Added an answer on June 1, 2026 at 6:02 pm

    While you have included the mySQL header files in your code, you haven’t included the mySQL library in your link options.

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

Sidebar

Related Questions

I want to connect php to Access without using ODBC connection like MySQL. Please
I want to connect to MySQL from SBCL using CLSQL. I loaded CLSQL using
I'm using JSP and I want to connect to a local mySQL database thorough
I want to insert data in MYSQL database using python here my code import
Possible Duplicate: How to update a MySql DB using Flex I want to connect
I am using the following PHP and MySQL code to pull high score records
Using Robotframework 2.6.3 and the python database library, I want to connect to MySql
I want to connect to DB using the iSeries Client Access driver. I use
I want to connect from home using SQL Server 2005 to another PC. I
I want to connect to DB2 from excel macro...This is my code, but it

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.