1) обработка cpp-файла препроцессором Templet -- режим DESIGN

In [ ]:
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
{
    // замените everest на имя вашего файла, замените -deploy на -design, если используется режим проектирования(только компиляция) 
    bool op1 = (system("~/bin/gen -design pingpong.cpp pingpong.dsg.cpp > out1.txt")==0);
    bool op2 = op1 ? (system("~/bin/skel -i pingpong.cpp -s pingpong.dsg.cpp > out2.txt")==0):false;
    if(op2) cout << "preprocessing is Ok:\n\n"; else  cout << "preprocessing failed:\n\n"; 
    {ifstream file("out1.txt"); for (string line; getline(file, line); ){cout << line << endl;} }
    if(op1){cout << endl; ifstream file("out2.txt"); for (string line; getline(file, line); ){cout << line << endl;} }
}
2) обработка cpp-файла препроцессором Templet -- режим DEPLOY

In [ ]:
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
{
    // замените everest на имя вашего файла, замените -deploy на -design, если используется режим проектирования(только компиляция) 
    bool op1 = (system("~/bin/gen -deploy pingpong.cpp pingpong.dsg.cpp > out1.txt")==0);
    bool op2 = op1 ? (system("~/bin/skel -i pingpong.cpp -s pingpong.dsg.cpp > out2.txt")==0):false;
    if(op2) cout << "preprocessing is Ok:\n\n"; else  cout << "preprocessing failed:\n\n"; 
    {ifstream file("out1.txt"); for (string line; getline(file, line); ){cout << line << endl;} }
    if(op1){cout << endl; ifstream file("out2.txt"); for (string line; getline(file, line); ){cout << line << endl;} }
}
3) компиляция и компоновка инструментами GCC

In [ ]:
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
{
    // замените everest на имя вашего файла
    system("g++ pingpong.cpp -I ~/lib -o ping-pong 2> out3.txt");
    ifstream file("out3.txt"); bool ok=true; for (string line; getline(file, line); ){cout << line << endl; ok = false;}
    if(ok)cout << "Compilation is Ok";
}
3) запуск программы

In [ ]:
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
{
    // замените everest на имя вашего файла
    system("./ping-pong 1> out3.txt");
    ifstream file("out3.txt"); for (string line; getline(file, line); ){cout << line << endl;}
}