Skip to main content

Quickly builds a standalone C++ file and runs the result.

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quickcpp-0.1.1.tar.gz (7.3 kB view details)

Uploaded Source

Built Distribution

quickcpp-0.1.1-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file quickcpp-0.1.1.tar.gz.

File metadata

  • Download URL: quickcpp-0.1.1.tar.gz
  • Upload date:
  • Size: 7.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.10 Linux/5.8.0-59-generic

File hashes

Hashes for quickcpp-0.1.1.tar.gz
Algorithm Hash digest
SHA256 9bd02f6ddf65e0ade9899ef0c7d4a38613efac130805fcb121a4a1ed2accc1ad
MD5 c36c81d32027c98eacafb0d7b6dbcb14
BLAKE2b-256 9e8dfb71f97f322e92cbda5baa3c14b2d6734ca4f7bc56871271e516d4c0d5b5

See more details on using hashes here.

File details

Details for the file quickcpp-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: quickcpp-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.7 CPython/3.8.10 Linux/5.8.0-59-generic

File hashes

Hashes for quickcpp-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5493b7814491d3984f32ed9b6ecd319e3c0d38c79fed29298089d1e397853d51
MD5 77a8f815a8058d144589a5862bb93e97
BLAKE2b-256 d2977c3bada224d33f2a74dd94b9d5f2d45953880c455ff423f97b3ff0bc42ad

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page