I think you can do that in UNIX, but would have to compile both wav_repeater.cpp tinywav.cpp together.
Get all the files and try like: g++ -O3 wav_repeater.cpp tinywav.cpp -o wav_repeater -static-libgcc -static-libstdc++ -Wl,-Bstatic -lstdc++ -lpthread -Wl,-Bdynamic
Those libraries will allow your executable to be redistributed.
It once gave a tremendous error with "g++ wav_repeater.cpp tinywav.cpp" (test compile), but after some/a lot of fiddling, the error was reduced to this:
tinywav.cpp:1:9: warning: #pragma once in main file
1 | #pragma once | ^~~~
wav_repeater.cpp: In function 'std::string bytes_format(unsigned int)': wav_repeater.cpp:20:13: error: 'KB' was not declared in this scope; did you mean '? 20 | if (B < KB) { return std::to_string(B) + " Bytes"; }
| ^~ | B
wav_repeater.cpp:21:23: error: 'MB' was not declared in this scope; did you mean '? 21 | else if (B>KB &&B<MB) { return std::to_string(B/ KB) + " k"; } | ^~
| B wav_repeater.cpp:22:28: error: 'GB' was not declared in this scope; did you mean '? 22 | else if (B > MB && B < GB) { return std::to_string(B/ MB) + " M"; }
| ^~
| B wav_repeater.cpp:23:28: error: 'TB' was not declared in this scope; did you mean '?
23 | else if (B > GB && B < TB) { return std::to_string(B / GB) + " G"; } | ^~ | B
wav_repeater.cpp: In function 'std::string human_format(unsigned int)': wav_repeater.cpp:29:18: error: 'KB_h' was not declared in this scope 29 | if (B < KB_h) { return std::to_string(B) + " b"; } | ^~~~
wav_repeater.cpp:30:30: error: 'MB_h' was not declared in this scope
30 | else if (B > KB_h && B < MB_h) { return std::to_string(B / KB_h) + " Thousand"; } | ^~~~ wav_repeater.cpp:31:30: error: 'GB_h' was not declared in this scope
31 | else if (B > MB_h && B < GB_h) { return std::to_string(B / MB_h) + " Million"; } | ^~~~ wav_repeater.cpp:32:30: error: 'TB_h' was not declared in this scope 32 | else if (B > GB_h && B < TB_h) { return std::to_string(B / GB_h) + " Billion"; }
| ^~~~ wav_repeater.cpp: In function 'int main(int, char**)': wav_repeater.cpp:57:27: error: 'CtrlHandler' was not declared in this scope
57 | SetConsoleCtrlHandler(CtrlHandler, TRUE);
| ^~~~~~~~~~~ wav_repeater.cpp:57:40: error: 'TRUE' was not declared in this scope
57 | SetConsoleCtrlHandler(CtrlHandler, TRUE);
| ^~~~
wav_repeater.cpp:57:5: error: 'SetConsoleCtrlHandler' was not declared in this scope 57 | SetConsoleCtrlHandler(CtrlHandler, TRUE);
| ^~~~~~~~~~~~~~~~~~~~~ wav_repeater.cpp:60:5: error: 'cxxopts' has not been declared 60 | cxxopts::Options options("MyProgram", "One line description of MyProgram"); | ^~~~~~~ wav_repeater.cpp:61:5: error: 'options' was not declared in this scope; did you mean 'htons'? 61 | options.add_options()
| ^~~~~~~ | htons
wav_repeater.cpp:62:75: error: 'cxxopts' has not been declared 62 | ("d,dur", "Duration in HH:MM:SS format. Length of the final file",cxxopts::value<std::string>()->default_value(DEFAULT_DURATION))
| ^~~~~~~ wav_repeater.cpp:62:101: error: expected primary-expression before '>' token
62 | ("d,dur", "Duration in HH:MM:SS format. Length of the final file", cxxopts::value<std::string>()->default_value(DEFAULT_DURATION)) | ^
wav_repeater.cpp:62:103: error: expected primary-expression before ')' token
62 | ("d,dur", "Duration in HH:MM:SS format. Length of the final file", cxxopts::value<std::string>()->default_value(DEFAULT_DURATION))
| ^
wav_repeater.cpp:62:120: error: 'DEFAULT_DURATION' was not declared in this scope
62 | ("d,dur", "Duration in HH:MM:SS format. Length of the final file", cxxopts::value<std::string>()->default_value(DEFAULT_DURATION))
| ^~~~~~~~~~~~~~~~
wav_repeater.cpp:64:47: error: 'cxxopts' has not been declared 64 | ("f,freq", "Frequency of repeatition", cxxopts::value<double>()->default_value("0.0")) | ^~~~~~~ wav_repeater.cpp:64:62: error: expected primary-expression before 'double' 64 | ("f,freq", "Frequency of repeatition", cxxopts::value<double>()->default_value("0.0")) | ^~~~~~ wav_repeater.cpp:65:61: error: 'cxxopts' has not been declared 65 | ("v,volume", "Volume 0-1.00 of max. Default = 0.95", cxxopts::value<double>()->default_value(VOLUME_LEVEL))
| ^~~~~~~ wav_repeater.cpp:65:76: error: expected primary-expression before 'double' 65 | ("v,volume", "Volume 0-1.00 of max. Default = 0.95", cxxopts::value<double>()->default_value(VOLUME_LEVEL)) | ^~~~~~ wav_repeater.cpp:66:77: error: 'cxxopts' has not been declared 66 | ("r,rate", "Sampling Rate of the WAV file created. Default = 96000", cxxopts::value<int32_t>()->default_value(SAMPLING_RATE)) | ^~~~~~~ wav_repeater.cpp:66:99: error: expected primary-expression before '>' token 66 | ("r,rate", "Sampling Rate of the WAV file created. Default = 96000", cxxopts::value<int32_t>()->default_value(SAMPLING_RATE))
| ^ wav_repeater.cpp:66:101: error: expected primary-expression before ')' token 66 | ("r,rate", "Sampling Rate of the WAV file created. Default = 96000", cxxopts::value<int32_t>()->default_value(SAMPLING_RATE)) | ^ wav_repeater.cpp:66:118: error: 'SAMPLING_RATE' was not declared in this scope
66 | ("r,rate", "Sampling Rate of the WAV file created. Default = 96000", cxxopts::value<int32_t>()->default_value(SAMPLING_RATE)) | ^~~~~~~~~~~~~ wav_repeater.cpp:67:79: error: 'cxxopts' has not been declared 67 | ("n,infile", "Name of input file. Default = Ask for it at the prompt", cxxopts::value<std::string>()->default_value("")) | ^~~~~~~ wav_repeater.cpp:67:105: error: expected primary-expression before '>' token 67 | ("n,infile", "Name of input file. Default = Ask for it at the prompt", cxxopts::value<std::string>()->default_value("")) | ^ wav_repeater.cpp:67:107: error: expected primary-expression before ')' token 67 | ("n,infile", "Name of input file. Default = Ask for it at the prompt", cxxopts::value<std::string>()->default_value("")) | ^ wav_repeater.cpp:68:86: error: 'cxxopts' has not been declared 68 | ("o,outfile", "Name of output WAV file. Default = Ask for it at the prompt.", cxxopts::value<std::string>()->default_value("")) | ^~~~~~~ wav_repeater.cpp:68:112: error: expected primary-expression before '>' token
68 | ("o,outfile", "Name of output WAV file. Default = Ask for it at the prompt.", cxxopts::value<std::string>()->default_value("")) | ^ wav_repeater.cpp:68:114: error: expected primary-expression before ')' token
68 | ("o,outfile", "Name of output WAV file. Default = Ask for it at the prompt.", cxxopts::value<std::string>()->default_value("")) | ^ wav_repeater.cpp:84:54: error: expected primary-expression before '>' token 84 | int32_t sampling_rate = result["rate"].as<int32_t>(); | ^ wav_repeater.cpp:84:56: error: expected primary-expression before ')' token
84 | int32_t sampling_rate = result["rate"].as<int32_t>(); | ^ wav_repeater.cpp:86:47: error: expected primary-expression before 'double'
86 | double volume_level = result["volume"].as<double>(); | ^~~~~~
wav_repeater.cpp:88:39: error: expected primary-expression before 'double' 88 | double freq_r = result["freq"].as<double>(); | ^~~~~~
wav_repeater.cpp:90:62: error: expected primary-expression before '>' token 90 | std::string duration_param = result["dur"].as<std::string>();//DEFAULT_DURATION; | ^ wav_repeater.cpp:90:64: error: expected primary-expression before ')' token
90 | std::string duration_param = result["dur"].as<std::string>();//DEFAULT_DURATION;
| ^ wav_repeater.cpp:92:69: error: expected primary-expression before '>' token 92 | std::string in_filename_param = result["infile"].as<std::string>(); | ^ wav_repeater.cpp:92:71: error: expected primary-expression before ')' token 92 | std::string in_filename_param = result["infile"].as<std::string>(); | ^ wav_repeater.cpp:94:70: error: expected primary-expression before '>' token
94 | std::string out_filename_param = result["outfile"].as<std::string>(); | ^ wav_repeater.cpp:94:72: error: expected primary-expression before ')' token
94 | std::string out_filename_param = result["outfile"].as<std::string>(); | ^
wav_repeater.cpp:154:5: error: 'BYTE' was not declared in this scope 154 | BYTE* buffer = new BYTE[sz + 1]; | ^~~~ wav_repeater.cpp:154:11: error: 'buffer' was not declared in this scope; did you mean 'setbuffer'?
154 | BYTE* buffer = new BYTE[sz + 1]; | ^~~~~~ | setbuffer wav_repeater.cpp:154:24: error: 'BYTE' does not name a type 154 | BYTE* buffer = new BYTE[sz + 1]; | ^~~~ wav_repeater.cpp:205:5: error: 'TinyWav' was not declared in this scope 205 | TinyWav audioFile; | ^~~~~~~ wav_repeater.cpp:206:25: error: 'audioFile' was not declared in this scope
206 | tinywav_open_write(&audioFile, 1, sampling_rate, TW_INT16, TW_INLINE, out_filename_param.c_str());
| ^~~~~~~~~
wav_repeater.cpp:206:54: error: 'TW_INT16' was not declared in this scope 206 | tinywav_open_write(&audioFile, 1, sampling_rate, TW_INT16, TW_INLINE, out_filename_param.c_str()); | ^~~~~~~~
wav_repeater.cpp:206:64: error: 'TW_INLINE' was not declared in this scope
206 | tinywav_open_write(&audioFile, 1, sampling_rate, TW_INT16, TW_INLINE, out_filename_param.c_str()); | ^~~~~~~~~
wav_repeater.cpp:206:5: error: 'tinywav_open_write' was not declared in this scope
206 | tinywav_open_write(&audioFile, 1, sampling_rate, TW_INT16, TW_INLINE, out_filename_param.c_str());
| ^~~~~~~~~~~~~~~~~~
wav_repeater.cpp:266:13: error: 'tinywav_write_f' was not declared in this scope 266 | tinywav_write_f(&audioFile, audio_buffer, total_samples * sizeof(BYTE)); | ^~~~~~~~~~~~~~~
wav_repeater.cpp:268:20: error: type '<type error>' argument given to 'delete', expected pointer 268 | delete buffer; | ^~~~~~
wav_repeater.cpp:270:13: error: 'tinywav_close_write' was not declared in this scope 270 | tinywav_close_write(&audioFile); | ^~~~~~~~~~~~~~~~~~~
Even with -lstdc++ and -lpthread, it still gives those errors.