64-bit Windows uses the 32-bit compiling platform to compile MySQL APIs, mysqlapi

Source: Internet
Author: User

64-bit Windows uses the 32-bit compiling platform to compile MySQL APIs, mysqlapi

A week ago, I wrote a few small examples to get started with MySQL C API. Although it is in Windows (my work computer is a 64-bit Windows), but do not want to use VS, just want to use text software to write code, compile with cl, and then use link. After I wrote the simplest example, I couldn't compile it. The Code is as follows:

# Include <my_global.h> # include <mysql. h> int main (int argc, char ** argv) {printf ("MySQL client version: % s \ n", mysql_get_client_info (); return 0 ;}

I thought my cl command was incorrectly written, although I checked it N times and did not find any error. Then I will use VS to create a new project, so that the compilation command will not be wrong. I can't compile it, but I cannot find the definition of mysql_get_client_info. I have never felt the difference between Win32 and Win64 programming, so I did not think about it. After N times, I still couldn't find out the reason. I only had a variety of searches and finally found the same problem that I had encountered. I just don't have that kid shoes. I can calm down and analyze them to find out where the problem is. At first, I thought that Win32 and Win64 had no difference, so I always looked for the reason on the Compilation command.

As pointed out by the shoes, a 32-bit compiling environment in a 64-bit system does have a problem. Because the shoes use VS, TA right-click the selected project and choose Properties> Configuration Manager> Create a 64-bit platform. I don't want to use VS, so I use the environment that comes with VS, for example.

 

Select x64.

Finally: After encountering the problems caused by the differences between Win32 and Win64, the impression deepened a lot.

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.