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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:22:40+00:00 2026-06-07T13:22:40+00:00

I’m following the example from here and my code is identical. When I type

  • 0

I’m following the example from here and my code is identical.

When I type mysql_config –libs and mysql_config –cflags into the console as he explains, I get the same output as he shows. Yet, when I try to compile using

g++ -o output-file $(mysql_config –cflags) test.cpp $(mysql_config
–libs)

I get the errors:

test.cpp:3:25: error: mysql.h: No such file or directory
test.cpp: In function âint main()â:
test.cpp:6: error: âMYSQLâ was not declared in this scope
test.cpp:6: error: âconnâ was not declared in this scope
test.cpp:7: error: âMYSQL_RESâ was not declared in this scope
test.cpp:7: error: âresâ was not declared in this scope
test.cpp:8: error: âMYSQL_ROWâ was not declared in this scope
test.cpp:8: error: expected `;’ before ârowâ
test.cpp:13: error: âmysql_initâ was not declared in this scope
test.cpp:17: error: âmysql_real_connectâ was not declared in this scope
test.cpp:18: error: âmysql_errorâ was not declared in this scope
test.cpp:19: error: âexitâ was not declared in this scope
test.cpp:22: error: âmysql_queryâ was not declared in this scope
test.cpp:23: error: âmysql_errorâ was not declared in this scope
test.cpp:24: error: âexitâ was not declared in this scope
test.cpp:27: error: âmysql_use_resultâ was not declared in this scope
test.cpp:31: error: ârowâ was not declared in this scope
test.cpp:31: error: âmysql_fetch_rowâ was not declared in this scope
test.cpp:35: error: âmysql_free_resultâ was not declared in this scope
test.cpp:36: error: âmysql_closeâ was not declared in this scope

When I try ‘whereis mysql’ it shows /usr/bin/mysql, /usr/lib/mysql and /usr/share/mysql, but I’m not sure where mysql.h is located exactly. The admin of the server I’m working on said he installed MySQL and I can indeed create/manipulate tables using phpMyAdmin.

Also, please give me suggestions about this particular problem. I’m aware of C++ wrappers for MySQL but I’m trying to just use the C API for now. Thanks!

  • 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-07T13:22:42+00:00Added an answer on June 7, 2026 at 1:22 pm

    Here the code compiles fine (I just had to include stdlib.h for exit()). MySQL headers should be in /usr/include/mysql, and since you got the same output for “mysql_config –cflags”, you probably have a missing/broken package.

    Try reinstalling the packages he list on the begining of the article, or check in which package the headers are in your distro. I’m am using Ubuntu, and here the package with the headers is libmysqlclient15-dev.

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

Sidebar

Related Questions

I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am currently running into a problem where an element is coming back from
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I have a French site that I want to parse, but am running into

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.