foreword
I have to write a blog (plus rant), wow, I don’t really feel that this system is an anti-human system if I don’t use a Mac, because the C language is used to connect and operate mysql, and then there must be a header file mysql.h, however, The library of this file must be installed by itself, but the mac cannot operate on the Linux system, an apt-get install will do. Then I want to tentatively look at my include file. I am young and ignorant. I really don't know that there is no such file under mac. All library functions and .h are put under Xcode by it. Then I connected according to the online tutorials, made all kinds of things, and configured a bunch of problems in the other link flags of Xcode in one night, and the compilation was all wrong...indicating a crash. . . I came back at night to grope myself and finally solved this problem. There are many solutions on the Internet, but they are all for Xcode. Anyway, there is a problem with the configuration of my Xcode, so I simply don't do it... I changed a solution. , if there is an include library, just copy the .h file directly into it.
/usr/include missing solution
There is a software to manage these files under Xcode, download it directly, and then those files will be managed under the include file
xcode-select --install
Then I checked that my /usr/
does have it, and I put a bunch of .h files in it
mysql.h file solution
Then it is the pile of files that owe mysql.h.
Generally, when you download mysql, you should have it, but I don't have it. It's unfortunate... Let's
reproduce it, and use brew to download mysql
brew install mysql
The default path is /usr/local/Cellar/mysql
and then I just took the attitude of giving it a try, and wanted to see if I could find the file I wanted, so I entered the 5.7.17 directory.
When I saw the include, I instantly felt hopeful. I opened the include directory, ls, and all of them were .h files. They were all about mysql, including mysql.h. Then I used it by myself. The solution is to copy all the files under mysql/5.7.17/include to usr/include
and then try it out. Gcc looks at its own program, and sure enough, you're done.
The whole process is very nonsense and a fluke. It seems that I should be able to connect to the .h file in mysql, but I can't operate it, so I used the stupidest method, copy and paste... This is a very angry blog late at night.