You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/setup_vscode.md
+47-44
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ $ rm -rf p1-stats # Delete
32
32
```
33
33
34
34
## Install
35
-
Choose your platform below.
35
+
Choose your platform below. Also make sure to install extensions.
36
36
37
37
### Linux
38
38
Install the .deb package from the web [https://code.visualstudio.com/docs/setup/linux](https://code.visualstudio.com/docs/setup/linux).
@@ -71,70 +71,55 @@ $ code --version
71
71
x64
72
72
```
73
73
74
-
#### WSL remote mode
75
-
76
-
Use VS Code's [remote mode](https://code.visualstudio.com/docs/remote/wsl) to connect the VS Code graphical user interface (GUI) running on Windows to the Linux environment and tools like `g++` running on WSL.
77
-
78
-
WSL Remote Mode connects VS Code to a remote instance of a VS Code server running elsewhere. When you launch VS Code from the WSL terminal, a VS Code server is started within WSL and the VS Code UI running on Windows connects to that server.
79
-
80
-
<imgsrc="images/vscode065.png"width="512px">
81
-
82
-
Install the [WSL extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-wsl). It's OK if you have other extensions installed.
**Pitfall:** If you accidentally open VS Code from Windows mode, click on the green icon in the lower left hand corner and then select "Reopen Folder in WSL".
97
-
98
-
<imgsrc="images/vscode070.png"width="720">
99
-
</div>
100
-
101
74
### Extensions
102
75
Make sure VS Code is installed correctly by checking the version. You need version 1.52.1 or higher.
103
76
```console
104
77
$ code --version
105
78
1.52.1
106
79
```
107
80
108
-
Install the Microsoft [C/C++ extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools).
81
+
Install the Microsoft [C/C++ extensions](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools).
Verify that the clangd or CodeLLDB extensions are *not* installed. The clangd extension provides C/C++ intellisense which conflicts with the Microsoft C/C++ extension. The CodeLLDB extension provides C/C++ debugging support which causes confusion with the Microsoft C/C++ extension.
125
-
```consle
94
+
#### macOS
95
+
Install the [CodeLLDB extension](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb).
96
+
```console
97
+
$ code --install-extension vadimcn.vscode-lldb
98
+
```
99
+
100
+
Verify that the extension is installed. It's OK if you have other extensions installed.
101
+
```console
126
102
$ code --list-extensions
127
-
llvm-vs-code-extensions.vscode-clangd # REMOVE ME
128
-
vadimcn.vscode-lldb # REMOVE ME
103
+
vadimcn.vscode-lldb
129
104
```
130
105
131
-
Uninstall them if necessary.
106
+
#### Windows
107
+
Install the [WSL extension](https://code.visualstudio.com/docs/remote/wsl) to develop with Linux-based utilities like the `g++` compiler.
Verify that the extension is installed. It's OK if you have other extensions installed.
115
+
```console
116
+
$ code --list-extensions
117
+
ms-vscode-remote.remote-wsl
118
+
```
119
+
120
+
You'll know that VS Code is running in remote mode when you see the remote mode indicator in the bottom left corner.
121
+
122
+
<imgsrc="images/vscode069.png"width="768px">
138
123
139
124
## Create a project
140
125
To create a VS Code project, create a folder (directory). There are many ways to create folders: Finder AKA File Explorer, VS Code interface, VS Code integrated terminal, and the system terminal. We'll use the system terminal and call our example project `p1-stats`.
@@ -324,11 +309,15 @@ Click "create a launch.json file".
324
309
325
310
<imgsrc="images/vscode031.png"width="768px" />
326
311
327
-
Click "Add Configuration".
312
+
**macOS:** Select LLDB.
313
+
314
+
<imgsrc="images/vscode031b.png"width="768px" />
315
+
316
+
You may need to click "Add Configuration".
328
317
329
318
<imgsrc="images/vscode032.png"width="768px" />
330
319
331
-
Select a "Launch" configuration. This will create a default `launch.json` ([Microsoft Reference](https://code.visualstudio.com/docs/cpp/launch-json-reference)).
320
+
You may need to select a "Launch" configuration. This will create a default `launch.json` ([Microsoft Reference](https://code.visualstudio.com/docs/cpp/launch-json-reference)).
332
321
- macOS: "C/C++ (lldb) Launch"
333
322
- WSL orLinux: "C/C++ (gdb) Launch"
334
323
@@ -576,6 +565,11 @@ Press "Continue" to run the program to the next breakpoint, or the end, whicheve
576
565
## Troubleshooting
577
566
This section is for common problems and solutions.
578
567
568
+
### Compile and run
569
+
If you have trouble with the [compile and run](#compile-and-run) section, a good first step is to delete your `launch.json` and try the [compile and run](#compile-and-run) section again.
570
+
571
+
<imgsrc="images/vscode160.png"width="768px" />
572
+
579
573
### Intellisense C++ Standard
580
574
Intellisense is the feature that indicates compiler errors with red squiggly lines and suggests code completions. If the C++ standard is out-of-date, you'll see squiggles where you shouldn't.
581
575
@@ -601,6 +595,15 @@ Modify the `cStandard` and `cppStandard` settings in `c_cpp_properties.json`. D
[Microsoft C/C++ extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) provides debugging support and intellisense on Windows, Linux and macOS. At the time of this writing (January 2023) debug support has a [bug on macOS](https://github.com/microsoft/vscode-cpptools/issues/7240).
602
+
603
+
[CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb) provides debugging support for those using the LLVM compiler. Apple's compiler on macOS is based on LLVM.
604
+
605
+
[clangd](https://marketplace.visualstudio.com/items?itemName=llvm-vs-code-extensions.vscode-clangd) provides intellisense and requires the `clangd` language server, which is related to the LLVM compiler. We do not recommend installing the `clangd` extension with the Microsoft C/C++ extension because multiple intellisense providers can produce confusing results.
0 commit comments