Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to tell scons to use MinGW instead of MSVC

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?

like image 452
sashoalm Avatar asked Oct 31 '12 15:10

sashoalm


People also ask

Should I use MinGW or MSVC?

Is MinGW (MinGW-64) better than Cygwin in terms of MSVC alternative for creating Windows application? If your program will run only on Windows, then MinGW is likely the better choice. MinGW is designed to create Windows applications. It doesn't require users to install additional software to run your application.

How do I add MinGW compiler to my path?

In the Windows search bar, type 'settings' to open your Windows Settings. Search for Edit environment variables for your account. Choose the Path variable in your User variables and then select Edit. Select New and add the Mingw-w64 destination folder path to the system path.

Is MinGW same for C and C++?

The MinGW compiler is a well known and widely used software for installing GCC and G++ compilers for the C and C++ programming languages.

Is MinGW necessary for VS code?

You need to install MingW or GCC on your system in order to Run c,c ++ programs. VS Code is an IDE(integrated development environment) where you can compile and run those codes.


1 Answers

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

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

And then use env.Program() instead of Program().

like image 97
Torsten Avatar answered Oct 08 '22 00:10

Torsten