Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Linux by (18.4k points)

I am trying to compile the program and it returns the below error :

usr/bin/ld: cannot find -l<nameOfTheLibrary>

In my makefile, I use this command g++ and link to my library which is the symbolic link to my library located in another directory.

Is there any option to add to make it work, please?

1 Answer

0 votes
by (36.8k points)

If the library name is say libxyz.so and it is located on path say:

/home/user/myDir

Then link it to your program:

g++ -L/home/user/myDir -lxyz myprog.cpp -o myprog

Want to be a Linux expert? Come and join this linux course

 

Browse Categories

...