1 | initial version |
sudo apt-get install pgplot5
Once pgplot is installed, navigate to the directory where you have your source code files.
Create a file named 'Makefile' in that directory and open it in a text editor.
In the Makefile, add the following lines:
CC = /usr/bin/gcc
LIBS = -lpgplot -lcpgplot -lg2c -lX11 -lm
CFLAGS = -I/usr/include -I/usr/local/pgplot -O2
all: your_program
your_program : your_program.c
$(CC) $(CFLAGS) -o your_program your_program.c $(LIBS)
clean:
rm -f your_program
Replace 'your_program' with the name of your program. Make sure the source file is named the same way.
Save the Makefile and exit the text editor.
In the terminal, navigate to the directory with the Makefile and run the command 'make'. This will compile your program using the pgplot libraries.
If there are no errors, you can run your program by typing './your_program' in the terminal.