-1

I have an OS-agnostic makefile (ugh, I know) which supports both GNU and MSVC compilers (among others). It always generates .o object files when compiling, even when compiling for MSVC (which expects .obj files). This is not a major problem; cl issues warning

cl : Command line warning D9024 : unrecognized source file type '.o', object file assumed

and carries on, successfully compiling.

I'd like to remove this unsightly command line warning, and only this warning, but can't figure out any way to do it.

Arguments like IGNORE don't seem to suppress it, e.g. using

cl -IGNORE:D9024 ...

and techniques (like this one) to suppress warnings generated in-code don't apply for this command line warning.

Is there any way to suppress D9024?

Otherwise (and preferably), is there a way to tell MSVC that the provided .o files ARE object files, so that it needn't assume so?

Anti Earth
  • 4,671
  • 13
  • 52
  • 83
  • 1
    So it detected that .o is not a *source file* and dealt with it. You kinda have to admire the wisdom of the ancients. – Hans Passant Mar 08 '20 at 23:25
  • If you are also providing cl.exe with the /c option, you should not be sending it object files. Why is it receiving an object file when it thinks it should be getting a source file? – 0-0 Mar 08 '20 at 23:28
  • @0-0 I'm not doing so... The error occurs when linking my `.o` files with `cl`, without the `/c` flag – Anti Earth Mar 09 '20 at 18:48
  • @HansPassant I don't understand, this occurs at linking (no source files passed) and this warning does not occur if the object files are named `.obj` – Anti Earth Mar 09 '20 at 18:50

1 Answers1

1

Simplified by performing no linking with cl, instead explicitly invoking MSVC's link

Anti Earth
  • 4,671
  • 13
  • 52
  • 83
  • Is there a flag to ``CL`` to dump the linker invocation produced by the ``CL`` compler driver (the ``D`` in ``D9024``)? This would simplify replacing ``CL`` with ``LINK``. – user1254127 Oct 01 '21 at 12:32