Skip to content

r-harsh-r/huffman-encoder-cpp-optimised

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Compressor (Huffman) — Build & Usage

This repository contains a simple Huffman compressor program.

Build

The project is written in C++17. Example compile commands are shown below.

On Windows (MSYS2/MinGW or WSL) using g++:

g++ -std=c++17 -O2 -Icompressor -Ilib src/main.cpp compressor/huffman.cpp -o compressor.exe

On Unix-like systems (Linux, macOS):

g++ -std=c++17 -O2 -Icompressor -Ilib src/main.cpp compressor/huffman.cpp -o compressor

Notes:

  • Adjust include paths (-I...) if your directory layout differs.
  • If you want to build with separate object files or a Makefile, create a simple Makefile that compiles src/main.cpp and compressor/huffman.cpp.

Run

Usage (Windows):

./compressor.exe {input_path} {output_path} {operation}

Usage (Unix):

./compressor {input_path} {output_path} {operation}

Parameters:

  • {input_path}: path to the input file to encode or decode.
  • {output_path}: path where the output will be written.
  • {operation}: one of the valid operations below.

Valid operations:

  • -e : encode the input file to compressed format.
  • -d : decode a compressed file back to original.

Examples:

Encode a file:

./compressor.exe test/test.txt test/test_compressed.huf -e

Decode a file:

./compressor.exe test/test_compressed.huf test/test_decoded.txt -d

Troubleshooting

  • If you see missing header errors, make sure the -Icompressor and -Ilib include paths point to the directories that contain header files used by the sources (for example compressor/huffman.h and lib/minHeap.h).
  • If you want a silent build: add -s to strip symbols.
  • For large files, ensure you have enough memory and disk space.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages