Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Seriously this is my bugbear with code for windows: how did you figure that invocation out?

Anything for Linux you just type "make". If the author skipped a makefile, theres rarely much to it.

But when someone has a cpp file for Windows it looks like this.

 help



This is a misrepresentation. This command-line is the compiler invocation, and is not the equivalent to 'make' on Windows. The actual equivalent on Linux, in the same order of the arguments to cl.exe would be:

  cl /std:c++17 /EHsc /W4 /O2 /DUNICODE /D_UNICODE /wd4005 /Fe:RedSun.exe RedSun.cpp advapi32.lib ole32.lib user32.lib

  g++ -std=c++17 -Wall -O3 -DUNICODE -D_UNICODE -Wno-builtin-macro-redefined -o RedSun.exe RedSun.cpp -ladvapi -lole32 -luser32
I see no difference. One uses slash-demarcated arguments, the other uses hyphens. The g++ invocation is missing the flag for the exception handling model[1]. Otherwise, it is a matter of what you are used to. In fact, if you have MinGW, this exact command-line invocation will probably work correctly.

When you install the VS build tools you get nmake which processes most Makefiles just fine. Or you get a solution file, in which case you just open the solution in VS and press F5. Or if you are hung up about doing it in the command-line, it would be

  msbuild.exe foo.sln
Or with CMake, which has a cross-platform command-line,

  cmake --preset somepreset
Linux people who don't know Windows and complain that 'it looks like this' is my bugbear, when they can spend hours fixing a dumb in-tree driver with printf debugging that works plug-and-play on Windows.

[1]: https://learn.microsoft.com/en-gb/cpp/build/reference/eh-exc...




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: