简体   繁体   中英

c++ Makefile doesn't find library

i want to run a "make" command in linux terminal in order to use some c++ libs. Unluckily while running the "make" an error appears saying it cannot find the requested libs.

Here the relevant makefiles: 在此处输入图片说明

Here are the files in my filesystem which should be linked. 在此处输入图片说明

Why does makefile not find the libraries ? Thanks for all answers in advance

Try to modify your Makefile for -lgmp rather than -libgmp

In background the compiler adds the 'lib' onto the name as well as the extension .so and similar stuff.

Try running the following to get an overview of what the linker is trying to do:

ld -L [yourincludepath] -lgmp --verbose

Such resolution issues might be due to the fact you are trying to link a 64bit library with a 32bit application? Try installing a proper XX-bits of the lib maybe?

Try to add -m option (machine dependency):

ld -melf_i386 -L /usr/lib/i386-linux-gnu/ -lgmp --verbose

Other values which might be supported on your side:

elf_x86_64 elf32_x86_64 elf_i386 elf_iamcu i386linux elf_l1om elf_k1om i386pep i386pe

More info:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM