简体   繁体   中英

log4cpp: Linux can't find the lib files

I download the log4cpp in my Linux and I use the commands below to install:

./configure
make
make check
make install

After that, I can find the lib files below in the path "/usr/local/lib":

liblog4cpp.a
liblog4cpp.la
liblog4cpp.so
liblog4cpp.so.4
liblog4cpp.so.4.0.0

Then I tried to use the log4cpp in my cpp project, which is complied by gcc11.

But I got the error message:

Undefined reference to "log4cpp::Category::shutdown()"

I think it can't find the lib files. So I added liblog4cpp.so manually.

Now I got this error:

undefined reference to "pthread_key_create"

What should I do?

log4cpp是C ++ lib,我建议使用相同的C ++编译器进行配置和构建

Problem solved.
I got this error because the lib pthread isn't a lib by default. So we must add it manually for our project(for the IDE) or add it as a parameter when you compile(gcc -pthread). If everything's OK, we can find it in /usr/lib.

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