Skip to main content

C++ Setup Instructions

Follow these steps to set up and use the C++ license generator script in this repository.

1. Clone the Repository

git clone https://github.com/callmerocco/li-cen-se.git
cd li-cen-se

2. Install C++

Ensure you have a C++ compiler installed (C++17 or higher recommended). Check your compiler version:

g++ --version

If you need to install a compiler, use your OS package manager or install via your system’s toolchain (like Visual Studio on Windows, Homebrew on macOS, etc.).

3. Install Required Libraries

This script uses only the C++ standard library, so no extra libraries are required.

4. Prepare Required Files

  • Ensure you have a licenses.json file in the project root. This should contain license templates in JSON format.
  • (Optional) Create a .env file in the project root and add your OpenAI API key:
    OPENAI_API_KEY=your-openai-api-key-here

5. Run the Script

g++ -std=c++17 -o license_generator path/to/your_script.cpp

Replace path/to/your_script.cpp with the actual filename if different.

6. Usage

  • The script will prompt you to select a license type or choose "AI-generated".
  • Enter your name, project name, and year when prompted.
  • If you select "AI-generated", describe your custom license idea.
  • The script will generate a LICENSE file in the current directory.

7. Troubleshooting

  • If you see Error: OPENAI_API_KEY not set in environment., make sure your .env file exists and contains your API key, or set the environment variable manually:
    export OPENAI_API_KEY=your-openai-api-key-here

For more details, see the repo here.