Tool to expand C++ includes for competitive programmers.
From
pip
:$ pip install exinc
From source:
$ pip install .
Run the tool one first time for it to create a default configuration.
$ exinc --help
Now you'll find a configuration file in /home/$USER/.exinc
that you can edit.
First, you have to properly place the files you want to include. You should either:
- Put them in the same folder of your to-be-compiled source code;
- Or put them somewhere, and add such path to
DEFAULT_PATHS
in the.exinc
configuration file.
Notice that when you go with (2), you also have to make sure you add this path to other places of interest. For instance, when using vscode
, you also want to make sure IntelliSense will recognize these headers.
Now, you can write C++-based solutions and use your newly available includes:
// MyIncludedCode.cpp
int included_function() {
return 42;
}
// solution.cpp
#include "MyIncludedCode.cpp"
#include <bits/stdc++.h>
int32_t main() {
cout << included_function() << endl;
// Code should compile, and print 42.
}
Ultimately, this code will be expanded by Exinc to:
// solution.pre.cpp
int included_function() {
return 42;
}
#include <bits/stdc++.h>
int32_t main() {
cout << included_function() << endl;
// Code should compile, and print 42.
}