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 hashes)

Uploaded source

Built Distribution

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

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page