How do you correctly use /GUARD:CF MSVC flag?

  c++, cl, visual-studio, windows

I am trying to use the /GUARD:CD MSVC flag. From the documentation, it says

The /GUARD:CF option must be specified to both the compiler and linker

The documentation also says that /GUARD:CF requires the /DYNAMICBASE option to also be set.

However, when I try to compile, I see warnings for unrecognized options:

cl -c /W3 /O2 /EHsc /MP /Zi /nologo /MD /Zi /DUNICODE /D_UNICODE /D_CRT_SECURE_NO_DEPRECATE /LD -Isrc -Iimport/include -D_WINDOWS -D_FILE_OFFSET_BITS=64 -DWXUSINGDLL /GS /DYNAMICBASE /GUARD:CF    /Fo: redacted.cpp.obj redacted.cpp
cl : Command line warning D9002 : ignoring unknown option '/GU'
cl : Command line warning D9002 : ignoring unknown option '/GD'
cl : Command line warning D9002 : ignoring unknown option '/G:'
cl : Command line warning D9002 : ignoring unknown option '/GC'

At first I thought maybe I accidentally introduced non-printable characters in my text editor, but I verified with cat --show-nonprinting that that was not the case.

How can I correctly pass /GUARD:CF to the MSVC cl compiler so that it recognizes it?

Source: Windows Questions

LEAVE A COMMENT