SCons 无法选择编译器 (MinGW) [英] SCons can't pick the compiler (MinGW)

查看:100
本文介绍了SCons 无法选择编译器 (MinGW)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含以下代码的简单 SConstruct 文件

I have a simple SConstruct file with the following code

path = ['C:\\MinGW\\bin']
env = Environment(ENV = {'PATH' : path})

Program(target = 'myprogram', source = ['main.cpp'])

在 cmd 上运行 'scons' 会给出以下错误信息:

running 'scons' on cmd gives the following error message:

cl /Fomain.obj /c main.cpp /TP /nologo
'cl' is not recognized as an internal or external command,
operable program or batch file.
scons: *** [main.obj] Error 1
scons: building terminated because of errors.

看起来 SCons 没有选择我的编译器 (MinGW).我究竟做错了什么?我使用的是 64 位 Windows 7.

It looks like SCons does not pick my compiler (MinGW). What am I doing wrong? I'm on Windows 7 64bit.

推荐答案

environment 中设置 tools 变量后,您应该使用 env.Program('...') 而不是 Program('...').下面是我为 mingw 工作的 SConstruct:

After setting tools variable in environment you should use env.Program('...') instead of Program('...'). Below is my working SConstruct for mingw:

path = ['C:\\Dev\\MinGW\\x64-4.9.2-posix-seh-rt_v3-rev1\\mingw64\\bin']
temp = 'C:\\Temp'

env = Environment(ENV={'PATH': path, 'TEMP': temp}, 
                  tools=['mingw'])

env.Program('solver-tikhonov.cpp')

这篇关于SCons 无法选择编译器 (MinGW)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆