Fox-Star Search Fun

Pages: 12
How do I compile this code in Windows 10?

I tried using the "Developer Command Prompt for VS 2022" for the "cl.exe" tool and get the error message:

fatal error C1189: #error: "Requires C99 or greater. (C89/90 is 35 years old!)"
Try cl /std:c17 source.c to set the language standard.
With VS 2022 the default for C compilation is "legacy MSVC". That is C89. Ewwwww!

https://learn.microsoft.com/en-us/cpp/build/reference/std-specify-language-standard-version?view=msvc-170

You can specify on the command-line ISO C11 Standard (/std:c11), ISO C17 (2018) Standard (/std:c17) or Preview - Features from the Latest C Working Draft (std:clatest)

Someone did specify the language standard with his command-line:

• MSVC • cl /EHsc /W4 /Ox /std:clatest fox-star.c

Personally I'd try C latest first, then C17 and end up with C11.

Maybe I will muck around with the code later and see if I can get the stuff to compile within the IDE.
Well, the code provided earlier does compile as-is in the VS IDE -- C Latest or C17 or C11 -- though it has several warnings.

warning C4566: character represented by universal-character-name '\u21AF' cannot be represented in the current code page (1252)
Somewhere in your options you need to tell the compiler to use UTF-8 as the “execution encoding” (as in the compiler’s execution). I think you need an MSVC no older than the one from 2019 for that.

On the command-line you’ll need to add /utf8 to the compile options.
Last edited on
I'm a bit occupied with other things at the moment, but I'll look into that option later. I am using VS 2022, 2019 is but a distant memory.

The usual type of C code I mash on is Desktop WinAPI stuff, the old boilerplate code from the early days of Win app programming. The GUI stuff.

I think I need to use a different console/terminal other than the default conhost.exe as well. The graphics displayed were decidedly muddled looking when I ran the exe.

To reiterate a concern earlier brought up.... the code as originally offered DOES compile without error when compiling as C code and using a C standard other than the VS default. The little problems of warnings and weird looking graphics are fixable if I took the time to investigate and correct them.
Setting /utf-8 at the command-line at either the project level or for the translation unit gets rid of the warnings, but the graphics are still fubared. Even telling the console to use code page 65001 with "chcp 65001".

It does work, yes, it just ain't pretty lookin' when using the Win 10 default console. Something I'm kinda used to.
It’ll take me a little longer to get back access to my Windows box — I’ll look at it then.
Take your time, I already know how to ensure your code does compile without errors or warnings.
Topic archived. No new replies allowed.
Pages: 12