Skip to main content

quickcpp

quickcpp is a small command-line tool to quickly build and run a single C++ file. Handy for quick experimentations.

Usage

The simplest usage is quickcpp <path/to/some/cppfile>. When called like this, quickcpp builds the file (producing a a.out file) and runs the result.

$ cat examples/helloworld.cpp 
#include <iostream>

int main(int argc, char** argv) {
    std::cout << "Hello world!\n";
    return 0;
}

$ quickcpp examples/helloworld.cpp 
- Building ---------------------
c++ examples/helloworld.cpp -Wall -fPIC -std=c++17 -g
- Running ----------------------
Hello world!

Using other libraries

Want to experiment something with QtWidgets? You can specify any installed pkg-config compliant packages using -p <package>:

$ cat examples/qt.cpp 
#include <QApplication>
#include <QMainWindow>

int main(int argc, char** argv) {
    QApplication app(argc, argv);

    QMainWindow window;
    window.setWindowTitle("Hello World");
    window.show();

    return app.exec();
}

$ quickcpp -p Qt5Widgets examples/qt.cpp 
- Building ---------------------
c++ examples/qt.cpp -Wall -fPIC -std=c++17 -g -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtCore -I/usr/include/x86_64-linux-gnu/qt5 -lQt5Widgets -lQt5Gui -lQt5Core
- Running ----------------------

You should see a window like this one:

qt.png

Any package listed by pkg-config --list-all can be used by quickcpp.

Live reload

quickcpp can use entr to automatically rebuild and rerun your file. Just install entr and run quickcpp with the -l flag.

Installation

The recommended solution is to use pipx:

pipx install quickcpp

But you can also install it with pip:

pip install --user quickcpp

License

Apache 2.0

Release files for quickcpp 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for quickcpp 0.1.1
File Size Uploaded
quickcpp-0.1.1.tar.gz 7.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for quickcpp 0.1.1
File Interpreter ABI Platform
quickcpp-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.8 kB

Release files / quickcpp-0.1.1.tar.gz

Download URL quickcpp-0.1.1.tar.gz
Size 7.3 kB
Tags Source
SHA-256 checksum
How to use checksums
9bd02f6ddf65e0ade9899ef0c7d4a38613efac130805fcb121a4a1ed2accc1ad
BLAKE2b-256 checksum
How to use checksums
9e8dfb71f97f322e92cbda5baa3c14b2d6734ca4f7bc56871271e516d4c0d5b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.7 CPython/3.8.10 Linux/5.8.0-59-generic

Release files / quickcpp-0.1.1-py3-none-any.whl

Download URL quickcpp-0.1.1-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5493b7814491d3984f32ed9b6ecd319e3c0d38c79fed29298089d1e397853d51
BLAKE2b-256 checksum
How to use checksums
d2977c3bada224d33f2a74dd94b9d5f2d45953880c455ff423f97b3ff0bc42ad
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.7 CPython/3.8.10 Linux/5.8.0-59-generic

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page