Skip Navigation

How to add a beep to your C++ program

Note: The beep library was written at Carleton College for use by Carleton Students.

To make a c++ program beep, add beep.h to the list of included header files, and use the "beep" library call.

USAGE: beep(pitch,length) where pitch is the desired tone in Hz, and length is the desired duration in milliseconds

Compile with the the following syntax:

    g++ -o file file.cpp -L/usr/X11R6/lib -lbeep -lm -lX11

Here is an example program:

#include <iostream.h>
#include <beep.h>
void main(void)