How to tell scons to use MinGW instead of MSVC

最后都变了- 提交于 2019-11-30 08:56:47

问题


I'm trying to build the C++ port of zxing on Windows, but scons fails with:

cl : Command line error D8021 : invalid numeric argument '/Wextra'

I have both VS2010 and MinGW installed, and scons tries to use the MSVC compiler, even though the SConscript file assumes gcc and use gcc-specific parameters, which causes the error.

How can I tell scons to use MinGW instead?


回答1:


Scons uses MSVC compiler by default on windows. To set mignw compiler use tools parameter while creating Environment object.

env = Environment(tools = ['mingw'])



回答2:


Below is my working SConstruct for mingw on Windows:

import os

env = Environment(ENV={'PATH': os.environ['PATH'], 'TEMP': os.environ['TEMP']}, tools=['mingw'])
env.Program('main.cpp')

Windows Environment variables PATH and TEMP can be set externally. Environment variable PATH should include the bin folder path of mingw.



来源:https://stackoverflow.com/questions/13161690/how-to-tell-scons-to-use-mingw-instead-of-msvc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!