| |

VerySource

 Forgot password?
 Register
Search
Author: shjjzx

How to set the mysql c api to use it?

[Copy link]

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-7-28 14:30:01
| Show all posts
It mainly depends on which directory libmysqlclient.a is in. For example, mine is under /usr/local/mysql/lib, and the corresponding include is under /usr/local/mysql/include. Then the makefile can be written like this:

CC=gcc
INCLUDES = -I/usr/local/mysql/include
LIBS = -L/usr/local/mysql/lib -lmysqlclient -lz

example:example.o
CC -o -g example example.o $(LIBS)

example.o:example.c
CC $(INCLUDES) -c -g example.c

After this is written, the source code of <mysql/mysql.h> should be changed to <mysql.h>, because the location of mysql.h has been specified in the makefile.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-2 10:15:01
| Show all posts
LZ introduces the solution
Reply

Use magic Report

1

Threads

5

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-8-16 09:15:01
| Show all posts
cp /usr/local/mysql/lib/mysql/* /usr/lib/
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list