> For the complete documentation index, see [llms.txt](https://docs.aic-eec.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.aic-eec.com/c-c++-for-embedded-programming/development-environment-preparation/virtual-studio-code-wsl.md).

# การเชื่อมต่อ Virtual studio code เข้ากับ WSL

1. &#x20;เปิด Ubuntu ทำการ สร้าง folder ชื่อ “test\_project” ด้วยคำสั่งดังนี้

```
mkdir test_project
```

และ คำสั่ง ls เพื่อแสดงโฟล์ที่ได้สร้างไว้

![](https://paper-attachments.dropbox.com/s_8A1FED18EA21FC9C95036AEB616EAFA7245C9BB7CFEEC278232A34CCEF5C73AD_1606914351183_image.png)

2\. เปิดโปรแกรม Virtual studio code&#x20;

&#x20;     2.1 คลิ๊กตามภาพด้านล่าง

![หน้าต่างโปรแกรม VS Code](https://paper-attachments.dropbox.com/s_8A1FED18EA21FC9C95036AEB616EAFA7245C9BB7CFEEC278232A34CCEF5C73AD_1606912619525_Untitled.png)

&#x20;      2.2 เลือก Remote-wsl: Open Folder In WSL… ตามภาพด้านล่าง

![](https://paper-attachments.dropbox.com/s_8A1FED18EA21FC9C95036AEB616EAFA7245C9BB7CFEEC278232A34CCEF5C73AD_1606914884105_image.png)

&#x20;    2.3 เลือก โฟลเดอร์ชื่อ test\_project ที่เราได้สร้างจากขั้นตอนที่ 1&#x20;

![](https://paper-attachments.dropbox.com/s_8A1FED18EA21FC9C95036AEB616EAFA7245C9BB7CFEEC278232A34CCEF5C73AD_1606914915849_image.png)

&#x20;   2.4 ไปที่แถบเมนูของโปรแกรม Virtual studio code ที่ flie เลือก New Flie&#x20;

&#x20;   2.5 Copy โค้ดไปใส่ แล้วกด Ctrl+S เพื่อทำการ save ไฟล์ชื่อว่า “hello\_world.cpp”&#x20;

```
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
   vector<string> msg {"Hello", "C++", "World", "from", "VS Code", "and the C++ extension!"};
   for (const string& word : msg)
   {
      cout << word << " ";
   }
   cout << endl;
}
```

&#x20;  2.6 ไปที่แถบเมนู เปิด terminal เลือก New terminal จะแสดงหน้า terminal ดังภาพด้านล่าง

![](https://1856353139-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MClo3nC-1US0rbK8Qau%2F-MNZ0euA3sOjjb8fpcjM%2F-MNZ4XrCoBzid5-TVBLt%2FehzvEYDM.png?alt=media\&token=2534926c-245e-4aa2-ba96-c42256a6e07a)

&#x20;   2.7 พิมพ์คำสั่งลงใน terminal ดังนี้&#x20;

```
g++ hello_world.cpp -o hello
ls
./hello
```

![ผลการรันโปรแกรม hello](https://paper-attachments.dropbox.com/s_8A1FED18EA21FC9C95036AEB616EAFA7245C9BB7CFEEC278232A34CCEF5C73AD_1606915954228_image.png)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.aic-eec.com/c-c++-for-embedded-programming/development-environment-preparation/virtual-studio-code-wsl.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
