Base config for C/C++ project
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
build/
|
||||
23
.vscode/launch.json
vendored
Normal file
23
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Compila ed esegui",
|
||||
"type": "cppvsdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}\\build\\app.exe",
|
||||
"args": [
|
||||
"/prova",
|
||||
"/v",
|
||||
"/a",
|
||||
"/h1",
|
||||
"${workspaceFolder}"
|
||||
],
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${workspaceFolder}",
|
||||
"environment": [ ],
|
||||
"console": "externalTerminal",
|
||||
"preLaunchTask": "build"
|
||||
}
|
||||
],
|
||||
"version": "2.0.0"
|
||||
}
|
||||
35
.vscode/tasks.json
vendored
Normal file
35
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"tasks": [
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "clean",
|
||||
"command": "del *.*",
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}\\build\\"
|
||||
},
|
||||
"detail": "Pulisci progetto",
|
||||
"problemMatcher": [ ]
|
||||
},
|
||||
{
|
||||
"type": "shell",
|
||||
"label": "build",
|
||||
"command": "cl.exe",
|
||||
"args": [
|
||||
"/Zi",
|
||||
"/EHsc",
|
||||
"/nologo",
|
||||
"/Fe${workspaceFolder}\\build\\app.exe",
|
||||
"${workspaceFolder}\\src\\*.cpp"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}\\build"
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$msCompile"
|
||||
],
|
||||
"group": "build",
|
||||
"detail": "Compila progetto"
|
||||
}
|
||||
],
|
||||
"version": "2.0.0"
|
||||
}
|
||||
10
src/func.cpp
Normal file
10
src/func.cpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#include <iostream>
|
||||
#include "func.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int addition(int a, int b)
|
||||
{
|
||||
cout << __FILE__ << " - " << __LINE__ << endl;
|
||||
return a + b;
|
||||
}
|
||||
6
src/func.h
Normal file
6
src/func.h
Normal file
@@ -0,0 +1,6 @@
|
||||
#ifndef __FUNC
|
||||
#define __FUNC
|
||||
|
||||
int addition(int a, int b);
|
||||
|
||||
#endif //__FUNC
|
||||
50
src/main.cpp
Normal file
50
src/main.cpp
Normal file
@@ -0,0 +1,50 @@
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <winerror.h>
|
||||
#include "func.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
for (size_t i = 0; i < argc; i++)
|
||||
{
|
||||
cout << "Arg:\t" << argv[i] << endl;
|
||||
}
|
||||
|
||||
cout << "\n_MSC_VER\t\t" << _MSC_VER << endl;
|
||||
cout << "C++ version: " << __cplusplus << endl;
|
||||
|
||||
cout << "\nTEST VECTOR MATRIX" << endl;
|
||||
|
||||
vector<vector<string>> v1{
|
||||
vector<string>{"1.1", "1.2", "1.3"},
|
||||
vector<string>{"2.1", "2.2", "2.3"},
|
||||
vector<string>{"3.1", "3.2", "3.3"}};
|
||||
|
||||
for (size_t i = 0; i < v1.size(); i++)
|
||||
{
|
||||
for (size_t j = 0; j < v1[i].size(); j++)
|
||||
{
|
||||
cout << v1[i][j];
|
||||
if (v1[i].size() - 1 > j)
|
||||
cout << " - ";
|
||||
}
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
cout << endl;
|
||||
|
||||
vector<string> msg{"Hello", "World", "from", "VS Code", "and the C++ extension!", "again"};
|
||||
|
||||
for (const string &word : msg)
|
||||
{
|
||||
cout << word << " ";
|
||||
}
|
||||
cout << endl;
|
||||
|
||||
cout << "addition: " << addition(900, 110) << endl;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
Reference in New Issue
Block a user