A (pseudo) interpreter for C++ script
C++ Python C CMake
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
benchmark/loop
doc
examples
mingw-test
test
.gitignore
Action.cpp
Action.h
CMakeLists.txt
Cpp2ObjAction.cpp
Cpp2ObjAction.h
DependencyGraphEntity.cpp
DependencyGraphEntity.h
FileEntity.cpp
FileEntity.h
FileSig.h
GchMagic.cpp
GchMagic.h
H2GchAction.cpp
H2GchAction.h
Loggers.cpp
Loggers.h
MiniLogger.cpp
MiniLogger.h
MustExistFileEntity.cpp
MustExistFileEntity.h
Obj2ExeAction.cpp
Obj2ExeAction.h
PRECOMPILEDHEADERS
PhonyEntity.cpp
PhonyEntity.h
README.chinese.md
README.md
SOURCEFILES
ShebangMagic.cpp
ShebangMagic.h
UpdateDependencyGraphAction.cpp
UpdateDependencyGraphAction.h
VulnerableFileEntity.cpp
VulnerableFileEntity.h
config.txt.sample
cpps.cbp
cpps.epmprj
generalcxx-debug.options
generallink-any.options
global.h
helpers.cpp
helpers.h
main.cpp
note.txt
samples.cpp
samples.h
std.h

README.md

CPPS - A (Pseudo) Interpreter for C++ Script

Note: There is also a Chinese version.

Build & Install

mkdir build-cpps
cd build-cpps
cmake ../cpps
make
make test
sudo make install

Script consisting of only one .cpp file

cpps hello.cpp

Script consisting of multiple one .cpp files

Such as:

  • hello.cpp
  • foo.cpp
  • foo.h

If you use a traditional approach such as GCC & Makefile

You need add a line such as

#include "foo.h"

to hello.cpp that calls functions defined in foo.cpp and declared in foo.h and then add rules for compiling foo.cpp to your Makefile.

If you use CPPS

What you need is to add a comment after the #include "foo.h" directive, such as

#include "foo.h" // usingcpp

and then run the following command:

cpps hello.cpp

NOTE: if your .cpp file has a different name than the corresponding .h file, you should write:

#include "foo.h" // using fooandbar.cpp

where fooandbar.cpp is the file in which the definations of functions declared in foo.h reside.

If you use a library in hello.cpp

such as pthread

If you use a traditional approach such as GCC & Makefile

You need write

g++ -lpthread hello.cpp -o hello

If you ues CPPS

All you need to do is adding the following comment to any .cpp file of your script

// linklib pthread

Request a .h to be precompiled

For example, if you want to make std.h a precompiled header, all you need to do is adding a comment after the #include "std.h" directive as following:

#include "std.h" // precompile