0
我在写XC一个.so lib中找到参考:GCC 4.8不.so库
int x() { return 0; }
并将其编译为:
gcc -o libx.so --shared -fPIC x.c
然后我main.c中做了一个程序:
extern int x();
int main() { return x(); }
然后编译如下:
gcc -o main -L. -lx main.c
它总是报告错误:
xxx.c:(.text+0xa): undefined reference to `x'
collect2: error: ld returned 1 exit status
然而,它与GCC 4.1.2和4.4。任何人都知道为什么? 非常感谢。