Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpp #6947

Open
Raz270 opened this issue Jan 6, 2024 · 1 comment
Open

cpp #6947

Raz270 opened this issue Jan 6, 2024 · 1 comment
Assignees

Comments

@Raz270
Copy link

Raz270 commented Jan 6, 2024

tried to install c/cpp to VS CODE,

followed manuals for downloading compiler ,

edited
.vscode\c_cpp_properties.json

{ "configurations": [ { "name": "Win32", "includePath": [ "${workspaceFolder}/**" ], "defines": [ "_DEBUG", "UNICODE", "_UNICODE" ], "windowsSdkVersion": "10.0.22621.0", "compilerPath": "c:\\Program^ Files (x86)\\Microsoft^ Visual^ Studio\\2022\\BuildTools\\VC\\Tools\\MSVC\\14.38.33130\\bin\\Hostx64\\x64\\cl.exe", "cStandard": "c17", "cppStandard": "c++17", "intelliSenseMode": "windows-msvc-x64" } ], "version": 4 }

.vscode\launch.json

{ "version": "0.2.0", "configurations": [ { "name": "C/C++: cl.exe build and debug active file", "type": "cppvsdbg", "request": "launch", "program": "${fileDirname}\\${fileBasenameNoExtension}.exe", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false, "preLaunchTask": "C/C++: cl.exe build active file" } ] }

.vscode\tasks.json

{ "version": "2.0.0", "windows": { "options": { "shell": { "executable": "cmd.exe", "args": [ "/C", // The path to VsDevCmd.bat depends on the version of Visual Studio you have installed. "\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat\"", "&&" ] } } }, "tasks": [ { "type": "shell", "label": "cl.exe build active file", "command": "cmd", "args": [ "/K", "\"C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/Common7/Tools/VsDevCmd.bat\"", "&&", "cl.exe", "/Zi", "/EHsc", "/Fe:${fileDirname}\\${fileBasenameNoExtension}.exe", "${file}" ], "problemMatcher": ["$msCompile"], "group": { "kind": "build", "isDefault": true } } ] }

keep getting when trying to run
image

cl.exe build and debug is only usable when VS Code is run from the Developer Command Prompt for VS.

what should I do ?

@AlexandraKemperMS
Copy link
Collaborator

Hi @Raz270, thanks for reaching out.

In order to build and debug, the C++ extension needs certain environment variables on windows. To avoid having to hardcode them, you can just launch from the developer command prompt. Close your current instance of VS Code. Type "Developer Command Prompt" into the search bar of your computer. Then, navigate using the command prompt to the location of the folder you previously had open in vscode. Use the command "code ." to open that folder. Now the play button should work for you. If you want a more detailed step by step guidance, reference the first 3 steps in this section of our docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants