Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ignore cache files for sample projects
.vscode/ipch
browse*.db*
*.obj
*.pdb
*.exe
*.ilk
19 changes: 19 additions & 0 deletions Code Samples/BoxConsoleSample/Objects/box.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#ifndef BOX_H
#define BOX_H

/**
* Definition of a box object with three dimensions.
*/
struct box
{
int length;
int width;
int height;

int volume()
{
return length * width * height;
}
};

#endif
24 changes: 24 additions & 0 deletions Code Samples/BoxConsoleSample/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Box Sample
This sample is a simple C++ program that computes and outputs the volume of a box.

We use this example in our blog posts to illustrate new extension features.

## Build and Debug Active File
Available as of March 2019, "Build and Debug Active File" automatically configures the build tasks and kicks off a build and debug session. There are
three ways to get started with this feature.

### Command
While editing a file in your workspace folder, you can open the command palette and select the `C/C++: Build and Debug Active File` command.
This option will generate a tasks.json file for you, build your active source file, and then launch the debugger.

![Open command palette and select Build and Debug Active File](build_debug_command.png)

### Context Menu
While editing a file in a workspace folder, you can right click in the editor field and select the "Build and Debug Active File" context menu option.
This option will generate a tasks.json file for you, build your active source file, and then launch the debugger.

![Right click and select Build and Debug Active File](build_debug_context_menu.png)

### F5
Another way to begin building and debugging your active file is to execute the command by pressing <kbd>F5</kbd>. This method will configure
both a tasks.json and launch.json file for you, build your active source file, and then launch the debugger.
16 changes: 16 additions & 0 deletions Code Samples/BoxConsoleSample/box_sample.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <iostream>
#include "Objects/box.h"

using namespace std;

/**
* Calculate and print the volume of a box.
*/
int main()
{
box package{ 10, 10, 10 };
cout << "Package length: " << package.length << endl;
cout << "Package width: " << package.width << endl;
cout << "Package height: " << package.height << endl;
cout << "Package volume: " << package.volume() << endl;
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 0 additions & 2 deletions Code Samples/SampleClangProject/.gitignore

This file was deleted.

17 changes: 0 additions & 17 deletions Code Samples/SampleClangProject/.vscode/launch.json

This file was deleted.

19 changes: 0 additions & 19 deletions Code Samples/SampleClangProject/.vscode/tasks.json

This file was deleted.

10 changes: 0 additions & 10 deletions Code Samples/SampleClangProject/README.md

This file was deleted.

17 changes: 0 additions & 17 deletions Code Samples/SampleClangProject/main.cpp

This file was deleted.

1 change: 0 additions & 1 deletion Extension/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@ install.lock

# ignore vscode test
.vscode-test/
browse*db*