linux下c没有mysql_关于linux c下链接mysql出现无法找到mysqlclient-问答-阿里云开发者社区-阿里云...

本文详细解释了GCC编译器中的链接选项-l的使用方法及注意事项。通过实例展示了如何指定库文件搜索顺序,并强调了库文件加载顺序对程序链接的重要性。

gcc 相关参数说明

-llibrary-l library

Search the library named library when linking. (The second alternative with

the library as a separate argument is only for POSIX compliance and is not

recommended.)

It makes a difference where in the command you write this option; the linker

searches and processes libraries and object files in the order they are specified.

Thus, ‘foo.o -lz bar.o’ searches library ‘z’ after file ‘foo.o’ but before

‘bar.o’. If ‘bar.o’ refers to functions in ‘z’, those functions may not be loaded.

The linker searches a standard list of directories for the library, which is actually

a file named ‘liblibrary.a’. The linker then uses this file as if it had been

specified precisely by name.

The directories searched include several standard system directories plus any

that you specify with ‘-L’.

Normally the files found this way are library files—archive files whose members

are object files. The linker handles an archive file by scanning through it for

members which define symbols that have so far been referenced but not defined.

But if the file that is found is an ordinary object file, it is linked in the usual

fashion. The only difference between using an ‘-l’ option and specifying a file

name is that ‘-l’ surrounds library with ‘lib’ and ‘.a’ and searches several

directories.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值