我正在尝试使用scons构建工具构建一个简单的打印HelloWorld。
我的helloWorld.c文件包含:
#include "stdio.h"
int main()
{
printf("Hello, world!\n");
}
我的SConstruct包含:
Program(["helloWorld.c"])
运行scons时,得到如下结果,但没有可执行输出:
PS D:\ 01_code> scons -f SCOnstruct scons:正在读取SConscript文件...
scons:警告:不建议调用缺少错误的SConscript。 通过向SConscript调用添加must_exist = 0来进行过渡。 缺少SConscript'SCOnstruct' 文件“ C:\ Python27 \ Scripts \ scons”,第204行,在 scons:已完成读取SConscript文件的操作。 scons:建立目标... scons:“。”已是最新。 scons:完成构建目标。 PS D:\ 01_code>
我的目的是学习scons构建工具。 我有Windows 10,Python 27,最新的scons
答案 0 :(得分:0)
scons将打印警告消息“正在调用缺少的SConscript”。
在这种情况下,我想您是从不同于SConstruct和HelloWorld.c文件位置的目录运行scons。
您应该解决其他几个问题。
Program('hello', ['HelloWorld.c'])
答案 1 :(得分:0)
我看到许多小错误:
HelloWorld.c
#include <stdio.h>
int main()
{
printf("Hello, world!\n");
}
SConstruct
Program('HelloWorld',['HelloWorld.h'])
运行此操作将产生
# Note no need to specify -f SConstruct. SConstruct is the default file SCons will look for.
$scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o HelloWorld.o -c HelloWorld.c
gcc -o HelloWorld HelloWorld.o
scons: done building targets.
给出您的示例,我不知道您如何收到这样的警告。
scons: warning: Calling missing SConscript without error is deprecated.
我什至尝试像使用-f SConstruct一样进行呼叫
$scons -f SConstruct
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
gcc -o HelloWorld.o -c HelloWorld.c
gcc -o HelloWorld HelloWorld.o
scons: done building targets.