Turbo C/C++ is an ancient compiler from the DOS and 16-bit Windows times (see
Turbo C++ - Wikipedia[
^]).
While it can be installed on recent Windows versions that does not mean that you can create executables running on recent Windows versions. It creates 16-bit executables which are not supported anymore since Windows 8 (you would need the Embarcadero BCC32C/BCC32X C++ compiler to create executables that can be run by recent Windows versions).
Your code for Visual Studio does not work with Turbo C++ because it contains two VS specific lines not supported by Turbo C:
- stdafx.h is a file used (and created) by VS to support pre compiled headers and include the required Windows header files
#pragma comment(lib, ...)
is as VS specific preprocessor directive to link with the specified library
To compile your code with any other C/C++ compiler, you would have to configure it to use the include and library file paths of the Windows SDK, remove the two lines mentioned above, probably add including
Windows.h, and link with
winmm.lib.
I strongly suggest to not use Turbo C/C++ anymore besides you want to write a DOS application. But those can't use Windows libraries.