Ted's Blog

Happy coding

建立自己的库函数

Ted posted @ 2008年8月13日 23:20 in 未分类 with tags gcc ar , 1618 阅读

> cat add.c:

int add(int x, int y)
{
        return x + y;
}

> gcc -c add.c ====> 得到add.o



> ar -q libadd.a add.o ====> 得到静态库libadd.a



> cat test.c:

#include <stdio.h>

int add(int, int);

int main()
{
        printf("%d\n", add(3, 4));
        return 0;
}

> gcc test.c -ladd -L/home/xwzss/test ====> /home/xwzss/test为库所在路径



> ./a.out


7

Avatar_small
roblox generator 说:
2018年11月17日 20:30

Hi, roblox game is very funny game and easy to get free robux generator. this maximum played game many person can play it same on time to enjoyed it. free roblox game generator its gives many paltform to play its . and its Simpy to get on my website.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter