I need an external terminal in Visual Studio Code while working with C++ so I can have user input in the terminal. I can’t get it to work.<\/p>\n
Example Program that I can’t get an external teminal to work with:<\/p>\n
#include <iostream>\n#include <string>\n\nusing namespace std;\nint main() {\ncout << \"Hello World\";\n\n//Press enter to close.\nchar close;\ncout << \"\\nThis window may now be closed.\\n\";\ncin >> close;\nreturn 0;\n}\n\n<\/code><\/pre>\n
Advertisement
Launch.json:<\/p>\n
{\n// Use IntelliSense to learn about possible attributes.\n// Hover to view descriptions of existing attributes.\n// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387\n\"version\": \"0.2.0\",\n\"configurations\": [\n {\n \"name\": \"(Windows) Launch\",\n \"type\": \"cppvsdbg\",\n \"request\": \"launch\",\n \"program\": \"${workspaceFolder}/myfile.exe\",\n \"args\": [],\n \"stopAtEntry\": false,\n \"cwd\": \"${workspaceFolder}\",\n \"environment\": [],\n \"externalConsole\": true,\n },\n {\n \"name\": \"(Windows) Attach\",\n \"type\": \"cppvsdbg\",\n \"request\": \"attach\",\n \"processId\": \"${command:pickProcess}\"\n }\n ]\n}\n\n<\/code><\/pre>\nI also have File > Preferences > Terminal > Explorer Kind > [external]<\/p>\n
I can’t get anything to work. Please help! Thanks!<\/p>","upvoteCount":6,"answerCount":4,"datePublished":"2019-07-22T16:47:17.000Z","author":{"@type":"Person","name":"spiceuser-iy1mx","url":"https://community.spiceworks.com/u/spiceuser-iy1mx"},"suggestedAnswer":[{"@type":"Answer","text":"
I need an external terminal in Visual Studio Code while working with C++ so I can have user input in the terminal. I can’t get it to work.<\/p>\n
Example Program that I can’t get an external teminal to work with:<\/p>\n
#include <iostream>\n#include <string>\n\nusing namespace std;\nint main() {\ncout << \"Hello World\";\n\n//Press enter to close.\nchar close;\ncout << \"\\nThis window may now be closed.\\n\";\ncin >> close;\nreturn 0;\n}\n\n<\/code><\/pre>\nLaunch.json:<\/p>\n
{\n// Use IntelliSense to learn about possible attributes.\n// Hover to view descriptions of existing attributes.\n// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387\n\"version\": \"0.2.0\",\n\"configurations\": [\n {\n \"name\": \"(Windows) Launch\",\n \"type\": \"cppvsdbg\",\n \"request\": \"launch\",\n \"program\": \"${workspaceFolder}/myfile.exe\",\n \"args\": [],\n \"stopAtEntry\": false,\n \"cwd\": \"${workspaceFolder}\",\n \"environment\": [],\n \"externalConsole\": true,\n },\n {\n \"name\": \"(Windows) Attach\",\n \"type\": \"cppvsdbg\",\n \"request\": \"attach\",\n \"processId\": \"${command:pickProcess}\"\n }\n ]\n}\n\n<\/code><\/pre>\nI also have File > Preferences > Terminal > Explorer Kind > [external]<\/p>\n
I can’t get anything to work. Please help! Thanks!<\/p>","upvoteCount":6,"datePublished":"2019-07-22T16:47:17.000Z","url":"https://community.spiceworks.com/t/visual-studio-c-external-terminal/721997/1","author":{"@type":"Person","name":"spiceuser-iy1mx","url":"https://community.spiceworks.com/u/spiceuser-iy1mx"}},{"@type":"Answer","text":"
If you post code, please use the ‘Insert Code’ button. Please and thank you!<\/p>\n