In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article is about how to use Lccwin32 for MySQL development. Xiaobian thinks it is quite practical, so share it with everyone for reference. Let's follow Xiaobian and have a look.
I will demonstrate MYSQL development with Lccwin32 through a simple example. focal point
The square is not the code part, but the compiler's configuration lccwin32 itself ide editor part for Chinese
Support is equal to 0, and there is a bug in the header file reference path setting, we have to handle it manually! this is also
I think the importance of writing this note.
Just mentioned that there is a bug in the lccwin32 editor, we need to manually modify the makefile generated by the compiler
File cannot be compiled at all.
Assuming that you are using the default path, the makefile file automatically generated by the lccwin32 editor should be packaged
Similar subparagraphs:
CFLAGS=-I"c:lccinclude" -O -p6 -unused -ansic
If we add the multi-header file reference path directly from the editor, it will generate an error, so we add it manually.
The path becomes the following:
CFLAGS=-I"c:lccinclude" -I"c:mysqlinclude" -O -p6 -unused -ansic
ok! The first problem, the header file reference, was solved.
Now we move on to the next problem library file (.lib). Windows mysql library file using vc5 series
First, we need to use the library conversion tool included with lccwin32 to convert. After conversion, lccwin32 can be used.
To properly identify this library file. So the important question is how do we import library files. Lccwin32 in us
There are two ways to do this. The first is to type in the library name directly from the editor's library reference.
One is to use the compiler's preprocessor directive #pragma lib "library." I recommend the second option,
Because we need debug version library files for debugger in the development process, in order to be efficient in actual distribution, we
Then you need to use the opt version to generate the final release file, and set it directly in the editor in the lccwin32 environment
It's unwise!
Now that we've solved the header file and library file references, there's practically no problem. a simple
An example of a single is:
#pragma lib
#include
#include "mysql.h"
MYSQL *myData;
int main(int argc, char *argv[])
{
char userid[20];
strcpy(userid, "root"); //Account
char password[20];
strcpy(password, ""); //Password
char host[20];
strcpy(host, "localhost"); //host
char dbName[10];
strcpy(dbName, "test"); //database
if ( (myData = mysql_init((MYSQL*) 0)) &&
mysql_real_connect(myData, host, userid, password, dbName, MYSQL_PORT, NULL, 0))
printf("Mysql readyn");
else
exit(0);
mysql_close( myData ) ;
return 1;
}
If you follow this article completely, you have already produced a 3.03kb or 13.03kb(debugger) executable file. By the way,
I didn't know there was still competition to produce executable file sizes. mysql official routines with lccwin32 compiled volume
VC only produces executable files 1/5 the size!
Thank you for reading! About "how to use Lccwin32 MySQL development" this article is shared here, I hope the above content can be of some help to everyone, so that everyone can learn more knowledge, if you think the article is good, you can share it to let more people see it!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.