Ask Your Question
2

How to generate a makefile for pgplot on Ubuntu?

asked 2023-06-06 08:52:52 +0000

pufferfish gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-06-06 09:20:02 +0000

djk gravatar image
  1. Install pgplot on your Ubuntu system by running the following command in the terminal:
sudo apt-get install pgplot5
  1. Once pgplot is installed, navigate to the directory where you have your source code files.

  2. Create a file named 'Makefile' in that directory and open it in a text editor.

  3. 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
  1. Replace 'your_program' with the name of your program. Make sure the source file is named the same way.

  2. Save the Makefile and exit the text editor.

  3. In the terminal, navigate to the directory with the Makefile and run the command 'make'. This will compile your program using the pgplot libraries.

  4. If there are no errors, you can run your program by typing './your_program' in the terminal.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-06 08:52:52 +0000

Seen: 17 times

Last updated: Jun 06 '23