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.