/usr/bin/ld: cannot find -lcommon
时间: 2023-09-21 08:11:33 浏览: 46
This error message indicates that the linker (ld) is unable to find the library file named "libcommon.a" or "libcommon.so" that is needed to link your program.
To resolve this issue, you need to make sure that the library file is installed and its path is included in the linker search path. Here are some steps you can take:
1. Check if the library file is installed:
You can use the following command to search for the library file:
```
find / -name "libcommon.*"
```
If the library file is not installed, you need to install it by following the instructions provided by the library's documentation.
2. Add library path to linker search path:
You can add the directory containing the library file to the linker search path by using the "-L" option followed by the directory path. For example:
```
gcc -L/path/to/lib -o myprogram myprogram.c -lcommon
```
This tells the linker to search for the library file in the directory /path/to/lib.
3. Verify library name:
Make sure that the library file name is correct. For example, if the library file is named "libcommon.a", you need to link it using "-lcommon". If the library file is named "libmycommon.a", you need to link it using "-lmycommon".
Once you have resolved the issue, you should be able to link your program successfully.