###### tags: `compiler VSC With winsock`
# **Programming with Visual Studio Code**
1. 編譯聯網程式時:
* 若是使用vs code編輯再編譯時記得呼叫連結器(-l)呼叫(ws2_32)如下


2. 多個cpp檔:
1. include進入主程式

2. 在G++後串聯多個cpp檔案
# **How to do "Start Button" in VSC?**
1. In Marketplace(At last in left tool bar) to download "code Runner".

2. When you downloaded, you should see a new button added to VSC.

3. Now you get a Strat Button,
but it is not perfect yet, we should setting and use it to compiler winsock ".cpp"
1. If you Don't setting it. you can't Compiler winsock ".cpp"
2. First: Go to the Marketplace find code Runner and click set button.

3. Choose Extension setting(擴充設定).
4. Choose setting json.

5. Add at following text in to ".json":
```json
"code-runner.executorMap": {
"cpp": "cd $dir && g++ -std=c++14 *.cpp -o $fileNameWithoutExt.exe -lws2_32 && $dir$fileNameWithoutExt",
},
```
6. Note that this paragraph of text can compile all files in the folder. So you should put one project in one folder. Or revise code Runner's setting".json"
* For example: If you want to compile one ".cpp" you can revise ".json" at following text.
```json
"code-runner.executorMap": {
"cpp": "cd $dir && g++ $fileNameWithoutExt*.cpp -o $fileNameWithoutExt.exe -lws2_32 && $dir$fileNameWithoutExt",
},
```
# **Why use codeRunner Run .EXE have garbled?**
* **Is like ↓**

* **How to solve?**
I have a good solution to share with everyone.
1. Open the codeRunner setting, Search "run in terminal" and check this.

* **OR add following text in to ".json"**

2. Not only will there be no garbled characters, and you can enter to terminal.
# **Why use VSC to coding**
1. You can compile if you have a folder and code(Manage the project yourself)
2. Free
3. Good for learners and student
4. **我亂打的別信**
-lsw2_32