开发者

Is there a way to add '-lpthread' to default linker flag without change the makefile

开发者 https://www.devze.com 2022-12-18 22:22 出处:网络
HI, I am getting the following linker error on linux: My guess is it is missing \'-lpthread\' in开发者_JS百科 the linker thread.My question is if there is a way for me to set my environment on linux

HI,

I am getting the following linker error on linux: My guess is it is missing '-lpthread' in开发者_JS百科 the linker thread. My question is if there is a way for me to set my environment on linux such that it will add '-lpthread' when it links?

/usr/bin/ld: out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/libutils.a(Threads.o): in function androidCreateRawThreadEtc:frameworks/base/libs/utils/Threads.cpp:145: error: undefined reference to 'pthread_create'

Thank you.


You need to tell us more about how exactly you are compiling with gcc.

For example, if you are using a Makefile, the you can add -lpthread to the CFLAGS environment variable.

Edit: If you compile and link in two steps, then you should use the LDFLAGS environment variable for controlling the linker flags.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号