MySQL. h cannot be found for C-language connection to MySQL in Linux

Source: Internet
Author: User

LinuxLowerCLanguage connectionMySQLNot foundMySQL. hSolution

 

I installed MySQL yesterday. Today I tried to connect to MySQL by using C language and found that the command gcc-I/usr/include/MySQL connect was used. after C-lmysqlclient-O connect, the system prompts that "MySQL. h "file, t_t |.

The reason is actually very simple. Yesterday I only installed two packages, server and client. for normal use, this is enough, but for database development in Linux, you also need to install the devel development kit, and the version of the development kit should be the same as the version of the server and client package that I installed earlier. Otherwise, the installation will fail due to a conflict.

For installation of the server and client packages, see the previous log: detailed steps for Linux (Fedora 9) to uninstall and install MySQL.

Now, we will install the devel package. Note that the version must be consistent:

 

[Root @ localhost install] # rpm-IVH MySQL-devel-community-5.1.46-1.rhel5.i386.rpm <br/> preparing... ######################################## ### [100%] <br/> 1: mysql-devel-Community ################################### ######## [100%] <br/>

To avoid further problems, I installed the shared component package shared. Haha:

 

[Root @ localhost install] # rpm-IVH MySQL-shared-community-5.1.46-1.rhel5.i386.rpm <br/> preparing... ######################################## ### [100%] <br/> 1: mysql-shared-Community ################################### ######## [100%] <br/>

After the installation is complete, the compilation is passed. At this time, the "mysql. H" already appears under the/usr/include/MySQL directory. Happy ~

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.