Scons“Dir”命令不起作用?

时间:2017-01-15 03:50:55

标签: variables directory command scons expansion

我有一个名为“myc”的子目录,其中包含2个“.c”文件:

$ ls myc
1.c  f.c

我当前的目录有一个SConstruct:

$ cat SConstruct 
myc=Dir('myc')
print myc
Program('test2',myc)

运行scons,它会输出一堆错误:

$ scons
scons: Reading SConscript files ...
myc
scons: done reading SConscript files.
scons: Building targets ...
gcc -o test2 myc
/usr/bin/ld: cannot find myc: File format not recognized
collect2: error: ld returned 1 exit status
scons: *** [test2] Error 1
scons: building terminated because of errors.

有什么奇怪的:我希望“print myc”会列出“1.c”和“f.c”,令我失望的是它会输出“myc”,而不是变量值,编译也会失败。

如何纠正?

1 个答案:

答案 0 :(得分:1)

不确定为什么您认为将目录指定为目录的源是可行的?

文档中是否有某些内容让您相信这应该有效?

如果是这样,请指出它以便可以改进。

如果你这样做了:

gcc -o blah some_dir_name

那不行吗?

这应该做你要求的。

myc=Glob('myc/*.c')
print myc
Program('test2',myc)
相关问题