I am working in c++ in Visual Studio Code on Windows 10 using the Microsoft C/C++ extensions, and any usage of pipe() is not recognized by my editor. I have implemented code I know should work and I still get the red squiggly lines that tell me I have made a syntax error. The error occurs if I try to run it as well, in which it says:
error: 'pipe' was not declared in this scope
Using an online compiler I was able to run my code, but as my project uses local files I cannot work using that. This seems to be a Visual Studio Code issue, but I have yet to figure out why, and was wondering if there was some obvious insight about pipes in c++ that would fix my problem. I have tried switching my C++ standard from gnu++14 to gnu++23 to c++23 with no luck.
In case you want to use pipes in Windows you should go trough the Windows API, functions like: CreatedNamedPipe(), OpenFile(), CreateFile(). Pipes are an OS thing, so in UNIX they work differently to the way they do in Windows,also in unix most of the pipe functions are defined under /sys/ headers which is UNIX only, you might want to try getting those headers in Windows using cygwin.
Again if you are serious about pipes in Windows use the windows API, they have some great examples:
https://learn.microsoft.com/en-us/windows/win32/ipc/using-pipes
https://learn.microsoft.com/en-us/windows/win32/ipc/named-pipes
To use Windows API simply include <Windows.h>
which will include all of the underlying header files