Home > Enterprise >  cl : Command line warning D9002 : ignoring unknown option "-O3"
cl : Command line warning D9002 : ignoring unknown option "-O3"

Time:08-08

I want to build a project that uses various flags by type -O3 -Wall -std=c 11 using cython, but I get an error:

cl : Command line warning D9002 : ignoring unknown option

Maybe it is possible to replace compilation with VS with Cmake, or am I incorrectly specifying arguments in Windows?.

from setuptools import setup, Extension
from Cython.Build import cythonize

extensions = [
    Extension(name=f'{__name__}',
              sources=[f'file.pyx'],
              language='c  ',
              extra_compile_args=['-std=c  11', '-O3'],
              ),
]

setup(name=__name__,
      ext_modules=cythonize(extensions),
      )

CodePudding user response:

Seems like you are on Windows and use the MSVC compiler. Contrary to gcc and clang, MSVC has no -O3 optimization flag. On MSVC it should either be /Ox or /O2, see here for more details.

  • Related