cc1plus: warning: command line option “-Wstrict-prototypes” is valid for Ada/C/ObjC but not for C++

后端 未结 7 782
日久生厌
日久生厌 2020-12-13 12:40

I am building a C++ extension for use in Python. I am seeing this warning being generated during the compilation process - when a type:

python setup.py build         


        
7条回答
  •  [愿得一人]
    2020-12-13 13:10

    The following code fragment in setup.py will remove all instances of this pesky flag:

    # Remove the "-Wstrict-prototypes" compiler option, which isn't valid for C++.
    import distutils.sysconfig
    cfg_vars = distutils.sysconfig.get_config_vars()
    for key, value in cfg_vars.items():
        if type(value) == str:
            cfg_vars[key] = value.replace("-Wstrict-prototypes", "")
    # ==================================
    

提交回复
热议问题