Skip to content

Commit 35190a4

Browse files
committed
20260317-165339: MSVC C++ was never tried
1 parent 32c1e95 commit 35190a4

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

shared.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212

1313
#if defined(__cplusplus)
1414
#if defined(_MSC_VER)
15-
#define nob_cc_flags(cmd) cmd_append(cmd, "/W4", "/nologo", "/D_CRT_SECURE_NO_WARNINGS", "-I.")
15+
#define nob_cc_flags(cmd) cmd_append(cmd, "/TP", "/W4", "/nologo", "/D_CRT_SECURE_NO_WARNINGS", "-I.")
1616
#else
1717
#define nob_cc(cmd) cmd_append(cmd, "cc", "-x", "c++")
1818
#define nob_cc_flags(cmd) cmd_append(cmd, "-Wall", "-Wextra", "-Wno-missing-field-initializers", "-Wswitch-enum", "-ggdb", "-I.");
1919
#endif
2020
#else // __cplusplus
2121
#if defined(_MSC_VER)
22-
#define nob_cc_flags(cmd) cmd_append(cmd, "/W4", "/nologo", "/D_CRT_SECURE_NO_WARNINGS", "-I.")
22+
#define nob_cc_flags(cmd) cmd_append(cmd, "/TC", "/W4", "/nologo", "/D_CRT_SECURE_NO_WARNINGS", "-I.")
2323
#elif defined(__APPLE__) || defined(__MACH__)
2424
// TODO: "-std=c99", "-D_POSIX_C_SOURCE=200112L" didn't work for MacOS, don't know why, don't really care that much at the moment.
2525
// Anybody who does feel free to investigate.

tasks/20260317-165339/TASK.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# MSVC C++ was never tried
2+
3+
- STATUS: OPEN
4+
- PRIORITY: 100
5+
- TAGS: bug,msvc
6+
7+
Every time we were doing `cl.exe nob.c` MSVC was compiling everything in "C mode".
8+
You can force it to compile in "C++ mode" if you provide flag `/TP` (See
9+
[Specify Source File Type][source-file-type]). If you do `cl.exe /TP nob.c`
10+
everything falls apart.
11+
12+
We should fix everything and have a separate "C++ on MSVC" build on GitHub Actions.
13+
14+
[source-file-type]: https://learn.microsoft.com/en-us/cpp/build/reference/tc-tp-tc-tp-specify-source-file-type?view=msvc-170

0 commit comments

Comments
 (0)