gpt4 book ai didi

c - scons:警告:不推荐调用缺少的 SConscript 而不会出现错误

转载 作者:行者123 更新时间:2023-11-30 19:25:09 26 4
gpt4 key购买 nike

我正在尝试使用 scons 构建工具构建一个简单的打印 HelloWorld。

我的 helloWorld.c 文件包含:

#include "stdio.h"
int main()
{
printf("Hello, world!\n");
}

我的 SConstruct 包含:

Program(["helloWorld.c"])

当我运行 scons 时,我得到如下结果,但没有可执行输出:

PS D:\01_code> scons -f SCOnstructscons:读取 SConscript 文件...

scons:警告:不推荐调用缺少的 SConscript 而不会出现错误。通过将 Must_exist=0 添加到 SConscript 调用进行转换。缺少 SConscript 'SConstruct'文件“C:\Python27\Scripts\scons”,第 204 行,位于scons:完成读取 SConscript 文件。scons:建立目标...讽刺:“。”已是最新。scons:完成构建目标。PS D:\01_code>

我的目标是学习 scons 构建工具。我有 Windows 10、Python 27、最新的 scons

最佳答案

我看到很多小错误:

HelloWorld.c

#include <stdio.h>
int main()
{
printf("Hello, world!\n");
}

S构造

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.

关于c - scons:警告:不推荐调用缺少的 SConscript 而不会出现错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59223084/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com