Giter Club home page Giter Club logo

vscode-cpptools's Introduction

C/C++ for Visual Studio Code

Badge

The C/C++ extension adds language support for C/C++ to Visual Studio Code, including editing (IntelliSense) and debugging features.

Pre-requisites

C++ is a compiled language meaning your program's source code must be translated (compiled) before it can be run on your computer. VS Code is first and foremost an editor, and relies on command-line tools to do much of the development workflow. The C/C++ extension does not include a C++ compiler or debugger. You will need to install these tools or use those already installed on your computer.

  • C++ compiler pre-installed
  • C++ debugger pre-installed

Here is a list of compilers and architectures per platform officially supported by the extension. These are reflected by the available IntelliSense modes from the extension's IntelliSense configuration. Note that support for other compilers may be limited.

Platform Compilers Architectures
Windows MSVC, Clang, GCC x64, x86, arm64, arm
Linux Clang, GCC x64, x86, arm64, arm
macOS Clang, GCC x64, x86, arm64

For more information about installing the required tools or setting up the extension, please follow the tutorials below.

Overview and tutorials

C/C++ extension tutorials per compiler and platform

Quick links

Questions and feedback

FAQs
Check out the FAQs before filing a question.

Provide feedback
File questions, issues, or feature requests for the extension.

Known issues
If someone has already filed an issue that encompasses your feedback, please leave a 👍 or 👎 reaction on the issue to upvote or downvote it to help us prioritize the issue.

Quick survey
Let us know what you think of the extension by taking the quick survey.

Contribution

Contributions are always welcome. Please see our contributing guide for more details.

Microsoft Open Source Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Data and telemetry

This extension collects usage data and sends it to Microsoft to help improve our products and services. Collection of telemetry is controlled via the same setting provided by Visual Studio Code: "telemetry.enableTelemetry". Read our privacy statement to learn more.

vscode-cpptools's People

Contributors

andreeis avatar andrewbrianhall avatar andyneff avatar bernardin-ms avatar bobbrow avatar browntarik avatar colengms avatar csigs avatar delmyers avatar dependabot[bot] avatar devabhishekpal avatar elahehrashedi avatar fearthecowboy avatar grdowns avatar hackintoshwithubuntu avatar jasdriel avatar jogo- avatar john-patterson avatar jureid avatar mastrzyz avatar mezzode avatar michelleangela avatar pieandcakes avatar ronglums avatar sean-mcmanus avatar spebl avatar tara-raj avatar tarik-brown avatar wardengnaw avatar xisui-msft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

vscode-cpptools's Issues

Repetitive problem message when pointing to problem line

From @alexxx537 on April 26, 2016 7:11

  • VSCode Version: 1.0.0
  • OS Version: windows 7

Steps to Reproduce:

  1. In one header create warning message
  2. Include this header into multiple files
  3. Compile and go, to problem Mach in this header
  4. Problem message shows a list repetitive messages

It is strange to see list of problem messages that are the same.

Copied from original issue: microsoft/vscode#5792

Support #IFDEF

Similar to how #IF is currently supported, it would be great if also #IFDEF worked.

Here's an animation to clarify.

ifdef_animation

Operating System becomes extremely slow when parsing the default C++ includes

This is (partly) a duplicate of #26 and #24. On Linux the default include path is "/usr/include" which is fine for standard C programs. However, the C++ STL is missing by default (see #24) and has to be included in c_cpp_properties.json manually. Once this is done Visual Studio Code will start parsing the newly found includes (I assume those in /usr/include as well) which somehow makes the rest of the OS absurdely slow - even vim takes ages to respond. I assume this is due to high disk usage.

If I leave the system alone it will take about an hour until parsing is completed - resulting in a database file which is about 1GiB in size per project. This is where #26 kicks in: if I close and reopen Visual Studio Code the old database will be deleted and the whole process starts once again.

Not parsing the default includes is possible but those "include not found" warnings get annoying very fast.

Wrong output in Debug output of C/C++

Copied from microsoft/vscode#6285

  • VSCode Version: 1.1.0
  • OS Version: OS X Version 10.11.4

Steps to Reproduce:

  1. Write the following code
    int array[] = {9, 8, 7, 6, 5, 4, 3};
    int size = sizeof(array)/sizeof(int);
    for (int i = 0; i < size; i++)
    {
        fprintf (stdout, "%d ", array[i]);
        fflush(stdout);
    }
  1. output should be:

9 8 7 6 5 4 3

however the output is

8 7 6 5 4 3

The '9' is lacked.

Repetitive problem message when pointing to problem line

VSCode Version: 1.0.0
OS Version: windows 7

Steps to Reproduce:

  1. In one header create warning message
  2. Include this header into multiple files
  3. Compile and go, to problem Mach in this header
  4. Problem message shows a list repetitive messages

It is strange to see list of problem messages that are the same.

Task.ja=son for build

Task.json is created as the followings:

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

However it report the following error, though there are MergeSort.cpp and test.cpp in the working dicrectory:

clang: error: no such file or directory: '*.cpp'
clang: error: no input files

Cannot read property 'document' of null

From @vscodeerrors on April 6, 2016 8:13

Issue Id: 098051f7-8a68-a04d-fe08-5331e1befd6f

Versions
- 0.10.13-insider
- 17fa1cbb49e3c5edd5868f304a64115fcc7c9c2c
Stack
TypeError: Cannot read property 'document' of null
at extensions\ms-vscode.cpptools-0.4.1\out\src\C_Cpp.js:59:24
vs/workbench/node/pluginHostProcess.js#L4:7
vs/workbench/node/pluginHostProcess.js#L4:7
vs/workbench/node/pluginHostProcess.js#L4:7
vs/workbench/node/pluginHostProcess.js#L4:7
vs/workbench/node/pluginHostProcess.js#L4:7
vs/workbench/node/pluginHostProcess.js#L4:7
at doNTCallback0 (node.js:420:9)
at process._t

Copied from original issue: microsoft/vscode#5007

Passing environment variables to debugger: 'env' or 'environment'?

The documentation and examples for launch.json show the use of an object list (key/value pairs in {}) called 'env' for passing environment variables to a debugging session.

But on my version which I installed yesterday, it's an array ([]) called environment. Hovering over it to get Intellisense gives a description that corresponds with above.

How can I pass environment variables to the debugger?

Go to Definition opens a different copy of a file.

This happens on Linux with version 0.5.0 and vscode 1.0 and 1.1.0.

If I have a C file open, and it contains a function, and I click "go to definition" of that function, no matter from what open file (even from the same file) - this will cause the C file containing the function to be re-opened and appear twice in the active files list. The second file appears with the file's absolute path next to it.
This is confusing and causes clutter. I'm not sure if it's a bug in the extension or of vscode itself.

Attached - example of how it looks.
screenshot from 2016-05-12 18-49-33

C++ Attach on Linux Mint 17.3 does not work.

I attempted to use the C++ Attach feature of Visual Studio Code using gdb on Linux Mint 17.3 and it did not work. I created a simple helloworld application. Launching the application for debugging (C++ Launch) worked fine but attaching to an existing process did not. I placed a cin statement in to ensure it was paused while I did the attach. Here's the console output:

=thread-group-added,id="i1"
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/.
Find the GDB manual and other documentation resources online at:
http://www.gnu.org/software/gdb/documentation/.
For help, type "help".
Type "apropos word" to search for commands related to "word".
help
error while processing request 'evaluate' (exception: Specified argument was out of the range of valid values.\nParameter name: handle)

spawn .../corerun ENOENT when trying to debug C++ on Mac

From @DanB91 on April 22, 2016 2:25

  • VSCode Version: 1.0.0 (1.0.0)
  • OS Version: Mac OS X 10.11.4

Hi, I am trying to debug my program with the following configuration:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "C++ Launch (GDB)",
            "type": "cppdbg",
            "request": "launch",
            "launchOptionType": "Local",
            "miDebuggerPath": "/usr/local/bin/gdb",
            "targetArchitecture": "x64",
            "program": "${workspaceRoot}/build/rg",
            "args": [],
            "stopAtEntry": false,
            "cwd": "${workspaceRoot}/build",
            "environment": []
        }
    ]
}

When I try to run this configuration I get the error: spawn <home>/.vscode/extensions/ms-vscode.cpptools-0.4.2/debugAdapters/corerun ENOENT. Stopping the debug adapter.

Can't seem to find this issue anywhere else. gdb is signed and works on the command line.

Steps to Reproduce:

  1. Try to launch debug configuration

Any help would be greatly appreciated. Thanks!

Copied from original issue: microsoft/vscode#5637

Using network and disk

VSCode.Cpp.Extension.exe (v 0.5.0) is keep using network about 9Mbps steady number (in task manager), maybe I'm using samba mounted disk from my Linux box for my project.

  • For testing, left it with no source file opened.
  • After uninstalling this extension, my HDD is now quiet.

Localization

From 白乐航 - User review comment on extension market place page

This is what I have been looking for something lightweight,C++ compiler.Much love~ support Chinese,support windows.

.browse.VC.db including files excluded in the workspace settings.

I have explicitly excluded some directories from my workspace in settings.json.

These files do not show up in the explorer, but when I search for symbols I see you're searching the excluded folders.

Looking at the .db file using sqlite3 I can see you have included files that are excluded in my settings.json.

Mixed tabs and spaces when editing C code, when a 'settings.jason' for the workspace is set

the settings.jason content is the following:
// Place your settings in this file to overwrite default and user settings.
{
// The number of spaces a tab is equal to.
"editor.tabSize": 3
}

when i open my C project (not a C++), then the tabSize is ignored.
VSCode indicates that tab size is '6'. I have to manually change the tab size to the 'configured tab size'.

Mammoth .browse.VC.db in .vscode after creating c_cpp_properties.json (Linux only)

I've been through all the issues and there are many (both open and closed) that seem to report this bug and its associated behaviours but aren't linked:
#44 #39 #29 #26 #11 #6 (closed as duplicates #25 #14)

The problem: After installing the extension, as soon as you generate the c_cpp_properties.json file to declare the standard linux include location /usr/include, the extension goes off and builds .browse.VC.db (the symbol database) in the .vscode workfolder directory. This however takes hours to build and becomes a 1-3GB symbol database of what I can only imagine is the entire system's libraries. And it's created for each workfolder, and recreated in each workfolder everytime the project is opened. Even if it's just a simple hello_world.c. If you close vscode, the extension continues running, building this database with associated network, cpu and hdd activity.

This makes the extension unusable on linux.

Tried extension on Windows and the .browse.VC.db stays at small size.

vscode: 1.1.1
cppext: 0.5.0
distro: Archlinux
(I appreciate it's only officially tested on Ubuntu, and haven't tried to replicate on a Ubuntu distro)

As an aside the link on the blog post to this github repo is incorrect (missing an s)

Call hierarchy

Perhaps the inverse to #15; to be able to view an entire call hierarchy of a function.

Seen it implemented in Eclipse.

GLIBC 2.18 dependency

This was copied from the reviews on the extension page. Not sure if it is a language service issue, or a debugger issue.

Do not edit every workspace with files inside .vscode folder

  1. Install VSCode c++ extension
  2. Any workspace I open in vscode will get modified, even if it does not have C++ -> files will be added inside the .vscode folder

Optimally the extension would not touch the content of any workspace.
If that is not possible the extension should only touch the content of C++ workspaces. I believe this could be achieved by being activated on the event onDebug:cpp. This event will be availble in the April release.

Code completion with C/C++ extension

From @mhalber on April 3, 2016 18:51

Hi,
I've been testing the new C/C++ extension, however I am running into some problems with code completion suggestions.

Here is an example with C/C++ extension installed, forcing suggestions using cmd+space.
It results in perpetual "Loading..." pop up:
screen shot 2016-04-03 at 2 38 39 pm

With the extension uninstalled, the suggestions show up immediately
screen shot 2016-04-03 at 2 47 25 pm

The features like go to symbol and go to definition are working properly with the extension installed,
however it seems to hinder the code completion.

  • VSCode Version: 0.10.11
  • OS Version: El Captain (OS X 10.11.4 )

Copied from original issue: microsoft/vscode#4890

vscode-ext: Toggle header/source

Hi,

It would be nice if the vscode C++ extension had a Toggle header/source feature.

Example

Actually, I've already implemented such a feature bbenoist/vscode-togglehs but it would be better if it was directly available from the official extension IMO.

Extension has 939 installs, which means the feature actually has some audience.

Add Windows support

Multiple comments from User Reviews on extension marketplace page and other forums

Intellisense and tags doesnt work in Windows 7

Hi,
I have installed cpptools but Intellisense and symbols view is not working at all. Search for symbols command always displays "No Symbols Matching " message. I was wondering are there any dependencies to make it work for Windows?

Thank you,
Regards,
Raj

Show All symbols command is very slow

Searching for a symbol in very large C Project using Show All symbols command(Ctrl+t) is very very slow. Find In Files option is quicker than the show symbols command.

System: Windows 7 and .browse.VC.db file size approximately 1.1GB .

can't work on win7

i install the c/cpp extersion by copy the .vscode/extersions/ms-vscode.cpptools-0.5.0 folder to a pc which can't connect to internet.
this pc use win 7, after install, ctrl+shift+o show "we have no symbol information". and cannot find "go defintion" on right button menu, and the staut bar show text "undefinedwin32".

Program does not exist

on ubuntu 14.04
when trying to debug, causes this error:
launch: program '/home/leon/visual-studio/a01.cpp' does not exist

Can not work on win10

This ext cannot run on my XPS13 Win10 laptop even after the VS2015 Runtime package has been installed.

Path must be a string. Received undefined

From @vscodeerrors on April 6, 2016 7:50

Issue Id: d62ec6f0-0926-ab33-6205-be52435fc002

Versions
- 0.10.13-insider
- 17fa1cbb49e3c5edd5868f304a64115fcc7c9c2c
Stack
TypeError: Path must be a string. Received undefined
at assertPath (path.js:8:11)
at Object.win32.join (path.js:221:5)
at new ConfigurationProperties (C:\Users\a123.vscode-insiders\extensions\ms-vscode.cpptools-0.4.1\out\src\C_Cpp_ConfigurationProperties.js:24:35)
at Object.setupConfigurationProperties (C:\Users\a123.vscode-insiders\extensions\ms-vscode.cpptools-0.4.1\out\src\C_Cpp_ConfigurationProperties.js:163:15)
at C:\Users\a123.vscode-insiders\extensions\ms-vscode.cpptools-0.4.1\out\src\C_Cpp.js:70:66
at FSReqWrap.oncomplete (fs.js:82:15)

Copied from original issue: microsoft/vscode#5005

Need VS 2015 x86 redistributable in order to work on Windows

If you are a Windows user (Win7 in my case), and don't have Microsoft Visual Studio Redistributable 2015 x86 installed on your system the extension does not work at all.
But the bug itself is the lack of information about it. Some people is complaining that the extension does not find any symbols and seems that this may be the cause.

If you manually try to run
~\.vscode\extensions\ms-vscode.cpptools-0.4.2\bin\Microsoft.VSCode.CPP.Extension.exe
You'll get a dialog with the error of "MSVCP140.dll" not found.

It would be great to get info about this error when the extension is being loaded from vscode, otherwise you are not aware that something went wrong.

Thanks !

Parsing of NFS mounted drive is really slow (Ubuntu)

From @ashwinaj on April 14, 2016 22:47

  • VSCode Version: 1.0.0
  • OS Version: Ubuntu 14.04 LTS

Steps to Reproduce:

  1. Open an NFS mounted folder in VS Code with a mix of C++, js and python source code (1000's of files)
  2. Let the parsing (indexing) begin i.e. creation of the symbols database for intelliSense

It is really slow (it's been running for 4 hours). This isn't the case with a similar setup with Sublime Text 3 on the same NFS mounted folder.

Copied from original issue: microsoft/vscode#5282

"fstream" cannot be found while other headers work

For some reason VS-Code always complains that it cannot find the fstream header even though all other C++ standard library headers work perfectly fine. For example, the following code reproduces the issue:

#include <fstream>  // "Include file not found in include directory"
#include <iostream> // no errors...

This happens on both Windows (using Visual Studio includes) and OpenSuse even though the fstream header is present in the include directory.

Use the VSCode debugConsole instead of externalConsole

Thanks team for this pretty good extension.
It works on the latest Kubuntu 16.04; Vscode 1.1.0-insider

Will the xterm dependency be eliminated?

  • I'd rather pipe stdout/err to vscode's debug console, just like on gdb;
    (the Python extension does it)

Bug:

  • Redirecting a file as input source is currently not functional; e.g. by setting "args": [" < input.txt"], in launch.json

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.