New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

invalid numeric argument '/Wno-cpp' #51

Barfknecht opened this Issue May 22, 2017 · 10 comments


None yet
10 participants

Barfknecht commented May 22, 2017

After I run I encounter this:

cl : Command line error D8021 : invalid numeric argument '/Wno-cpp'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe' failed with exit status 2

I have all C++ tools installed and have updated my pip and setuptools.

python 3.5.2
Anaconda 64 bit


This comment has been minimized.

vignesh-m commented Jun 1, 2017

See #9 . They will not provide windows support for some reason


This comment has been minimized.

fengzean commented Jan 8, 2018

That engage in wool

@bughunter99 bughunter99 referenced this issue Jan 23, 2018


coco issue #238


This comment has been minimized.

yinyuecheng1 commented Feb 28, 2018

anyone knows how to solve this problem?


This comment has been minimized.

TonyNgo1 commented Apr 9, 2018

After tons of digging I've found a way to make it work:


  1. First go to cocoapi\PythonAPI\ and change line 14 from:
    extra_compile_args=['-Wno-cpp', '-Wno-unused-function', '-std=c99'],
    extra_compile_args={'gcc': ['/Qstd=c99']},
    as pointed out in this issue: CharlesShang/FastMaskRCNN#173

  2. And then try to run make from cocoapi\PythonAPI\pycocotools again.

  3. If you get C1083: Cannot open include file: 'vcruntime.h': No such file or directory go to your C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build directory and run the following script from

    pushd "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\"
    cmd /c "vcvars64.bat&set" |
    foreach {
    if ($_ -match "=") {
    $v = $_.split("="); set-item -force -path "ENV:\$($v[0])"  -value "$($v[1])"
    Write-Host "`nVisual Studio 2017 Command Prompt variables set." -ForegroundColor Yellow

    Then cd back to your cocoapi\PythonAPI\pycocotools and run make. It worked for me at this point :)


This comment has been minimized.

AtotheY commented Apr 9, 2018

@TonyNgo1 THANK YOU!


This comment has been minimized.

HarshalGarg commented Apr 10, 2018

cocoapi with windows support


This comment has been minimized.

LongruiDong commented Apr 20, 2018

after step1,i get different error:
Traceback (most recent call last): File "", line 23, in <module> cythonize(ext_modules) File "C:\Anaconda3\envs\caffe_env\lib\distutils\", line 151, in setup dist.run_commands() File "C:\Anaconda3\envs\caffe_env\lib\distutils\", line 953, in run_commands self.run_command(cmd) File "C:\Anaconda3\envs\caffe_env\lib\distutils\", line 972, in run_command File "C:\Anaconda3\envs\caffe_env\lib\distutils\command\", line 340, in run self.build_extensions() File "C:\Anaconda3\envs\caffe_env\lib\distutils\command\", line 449, in build_extensions self.build_extension(ext) File "C:\Anaconda3\envs\caffe_env\lib\distutils\command\", line 499, in build_extension depends=ext.depends) File "C:\Anaconda3\envs\caffe_env\lib\distutils\", line 547, in compile extra_postargs) TypeError: can only concatenate list (not "dict") to list make: *** [Makefile:3: all] Error 1
my :
ext_modules = [ Extension( 'pycocotools._mask', sources=['../common/maskApi.c', 'pycocotools/_mask.pyx'], include_dirs = [np.get_include(), '../common'], extra_compile_args={'gcc': ['/Qstd=c99']}, ) ]


This comment has been minimized.

TonyNgo1 commented Apr 20, 2018

@LongruiDong Unfortunately that's the same thing I have and it works on my machine. I was also able to compile it by removing the line completely ie:

ext_modules = [
        sources=['../common/maskApi.c', 'pycocotools/_mask.pyx'],
        include_dirs = [np.get_include(), '../common'],

So you could try that too. I assume the system determines how to compile if extra_compile_args is not set so you may get something different.


This comment has been minimized.

chrisrapson commented Jun 15, 2018

Thanks to the tips from @TonyNgo1 I managed to get through this. I didn't need any extra_compile_args, they just raised a couple of warnings when I included them. In addition to what was mentioned here, I had to add in a line with library_dirs = formatted the same as include_dirs. I ended up with

    include_dirs = [np.get_include(), '../common', 'C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.17134.0\\ucrt', 'C:\\Program Files (x86)\\Windows Kits\\10\\Include\\10.0.17134.0\\shared'],
    library_dirs = ['C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.17134.0\\um\\x64', 'C:\\Program Files (x86)\\Windows Kits\\10\\Lib\\10.0.17134.0\\ucrt\\x64'],

One final link error was a bit stranger: LINK : fatal error LNK1158: cannot run 'rc.exe'. For this one I had to add the folder with rc.exe to my PATH
$env:Path += ";C:\Program Files (x86)\Windows Kits\10\bin\10.0.17134.0\x64"


This comment has been minimized.

neoglez commented Aug 24, 2018

I made a repo to support To support Windows x64 build with Microsoft Visual C++ 9.0 standalone: Visual C++ Compiler for Python 2.7:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment