Quantcast
Channel: Compiling C++ code in Visual Studio Code - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Compiling C++ code in Visual Studio Code

$
0
0

I installed the recommended C/C++ extension made by Microsoft. I wish to now fix compiling.

I know visual studio code is an editor with no inbuilt compiler, however there is little to no information as to how to achieve a task of fix the configuration to be able to compile code.

I run linux ubuntu 14.04 and have gcc compiler installed. I wish to use this to compile the code.

I've ben looking at tasks and when in debug mode when launching it takes to this file:

lanuch.json (these are launch configurations):

{"version": "0.2.0","configurations": [        {"name": "C++ Launch (GDB)","type": "cppdbg","request": "launch","launchOptionType": "Local","targetArchitecture": "x64","program": "enter program name, for example ${workspaceRoot}/a.out","args": [],"stopAtEntry": false,"cwd": "${workspaceRoot}","environment": [],"externalConsole": true        },        {"name": "C++ Attach (GDB)","type": "cppdbg","request": "launch","launchOptionType": "Local","targetArchitecture": "x64","program": "enter program name, for example ${workspaceRoot}/a.out","args": [],"stopAtEntry": false,"cwd": "${workspaceRoot}","environment": [],"processId": "enter program's process ID","externalConsole": false        }    ]}

From here I'm lost. I don't actually know what to change here.

Also from this https://code.visualstudio.com/docs/editor/tasks there is an example of a task:

{"version": "0.1.0","command": "gcc","args": ["-Wall", "helloWorld.c", "-o", "helloWorld"],"problemMatcher": {"owner": "cpp","fileLocation": ["relative", "${workspaceRoot}"],"pattern": {"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$","file": 1,"line": 2,"column": 3,"severity": 4,"message": 5        }    }}

Again I don't know how to edit this so that it will compile my code.

I have the file start.cpp which includes my main function.

So how does one setup visual studio code to compile code in the easiest and most automated way?


Viewing all articles
Browse latest Browse all 3

Latest Images

Trending Articles





Latest Images