The problem :
I have to make program which uses pthreads. To do that , I have an Ubuntu VM on VirtualBox so someone would say im all set. But I was wondering if I can use POSIX libraries while still on my Windows machine.
How I imagine it :
Sort of an extension for vscode such that when I run the code , it runs on a VM and returns me the results of its terminal.
I read a post that talked about how use pthread-win32 , but this is not what im looking for , I want to be able to write POSIX compilable C code
Thanks in advance
2
Answers
What you could do is use WSL (Windows Subsystem for Linux). Since you only require the terminal and no visual application, this would suit you perfectly. The link below explains it better then I ever could, but this quote sums it up nicely:
https://code.visualstudio.com/docs/remote/wsl
My first suggestion for using a Linux style environment on a Windows PC would be to use WSL and connect to WSL from VS Code as Evert_B already explained.
You can just type
code .
in a WSL shell to start VS Code with the current folder as Workplace. Or you could chose to connect to WSL to setup the connection.As you already have a VM running Ubuntu on your system, you could use a very similar solution:
VS Code can also connect to a remote host using SSH.
My knowledge about required VirtualBox network settings to access the VM via TCP/IP is a bit rusty but you should clearly be able to connect to the VM via SSH and then edit, compile and run your code there.