skip to Main Content

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


  1. 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:

    • You can develop in a Linux-based environment, use Linux-specific toolchains and utilities, and run and debug your Linux-based applications all from the comfort of Windows.

    https://code.visualstudio.com/docs/remote/wsl

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search