LINUX下C语言编程经常需要链接其他函数,而其他函数一般都放在另外.c文件中,或者打包放在一个库文件里面,我需要在main函数中调用这些函数,主要有如下几种方法: 1.当需要调用函数的个数比较少时,可以直接在main函数中包含该文件,比如一个文件夹下包含add.c和main.c文件: 方法一: 文件add.c定义两个整数相加的函数,code如下: #include <stdio.h> #include <math.h> int add(int a,int b) { int z;
今天编译出现ld: 0706-006 Cannot find or open library file: -l xerces-c_static,ld:open(): A file or directory in the path name does not exist.这个熟悉得不能再 熟悉的链接错误. 很简单,编译器打开xerces-c_static.a失败.出现这个错误的原因往往是因为目录库文件xerces-c_static.a没被编译出来或不存在. 于是第一反应,看一下xerces-c_s