I've got a 'n.c' as main function, and 'o.c' as import function, like below:
$ cat n.c o.c
int f();
int main(){
f();
return 0;
}
#include<stdio.h>
int f(){
printf("hello\n");
return 2;
}
Then scons file like below:
Library('o.c')
Program('n.c',LIBS=['o'])
What I hope here is to compile o.c and generate libo.a(OK), and n.c will use this '.a' to generate final executable. So I specified LIBS=['o'], in hoep that it will specify an archive file to find libo.a library. But:
$ scons -Q
gcc -o n n.o -lo
/usr/bin/ld: cannot find -lo
collect2: error: ld returned 1 exit status
scons: *** [n] Error 1
Actually, scons interpreted my command to be '-lo', which is to find a dynamic shared library. This is not what I wanted, because during linking, archive is used like object files. Does '-l' work with archive files, and why scons interprets LIBS to use dynamic link shared libraries?
Thanks.