I am new here. I recently installed plotutils-dev on my mac using fink, but when I try to compile a little program I have by doing

gcc -g -o atomos.o atomos.c -lplot

it says

ld: library not found for -lplot
collect2: ld returned 1 exit status

I have searched the problem on the web with little success. The only thing I know is that when I type

dpkg -S libplot.dylib

it says

plotutils-dev: /sw/lib/libplot.dylib

which I believe it means I have installed libplot on my mac. So I don't know what is the problem. Any help is welcomed. I am a beginner so It would be nice if some guidelines are provided in a user-friendly way.

有帮助吗?

解决方案

The linker can't find the libplot library. I'm not familiar with mac, but with gcc you can tell it the path to the library with the -L flag, e.g.:

gcc -g -o atomos.o atomos.c -lplot -L/sw/lib/

(I'm guessing at that path, but you can probably figure out the path to the library if that isn't right.)

Also, it's probably a typo in your question, but I changed it to -lplot (note extra -l). You want the -l to link with the plot library.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top