lin1900
Newbie
Hi, I am having problem linking .so file to my main1.c
At first, I used the command below to create .so file from multiple c source and header files.
arm-linux-gnueabi-gcc -shared -o ~/Docs/examples/libmylib1.so -fPIC *.c -lpthread -ldl -lm
Then I created main1.c file in the same folder (~/Docs/examples) and used the following command to generate another .so file for main1.c that uses libmylib1.so
arm-linux-gnueabi-gcc -shared -o libmain2.so main1.c -idirafter ~/Docs/examples -lmylib1 -lpthread -ldl -lm
So far, it worked fine.
But, when I copy the libmylib1.so file to another folder and try to use it with another code.c file it doesn't work unless I add {-idirafter ~/Docs/examples} and let it know the original location of libmylib1.so. The new folder contains only libmylib1.so and code.c. Here is the command that I used and it isn't working.
arm-linux-gnueabi-gcc -shared -o libcode1.so code.c -idirafter ~/Docs/newlocation -lmylib1 -lpthread -ldl -lm
Any suggestions on how to fix this?
Thanks.
At first, I used the command below to create .so file from multiple c source and header files.
arm-linux-gnueabi-gcc -shared -o ~/Docs/examples/libmylib1.so -fPIC *.c -lpthread -ldl -lm
Then I created main1.c file in the same folder (~/Docs/examples) and used the following command to generate another .so file for main1.c that uses libmylib1.so
arm-linux-gnueabi-gcc -shared -o libmain2.so main1.c -idirafter ~/Docs/examples -lmylib1 -lpthread -ldl -lm
So far, it worked fine.
But, when I copy the libmylib1.so file to another folder and try to use it with another code.c file it doesn't work unless I add {-idirafter ~/Docs/examples} and let it know the original location of libmylib1.so. The new folder contains only libmylib1.so and code.c. Here is the command that I used and it isn't working.
arm-linux-gnueabi-gcc -shared -o libcode1.so code.c -idirafter ~/Docs/newlocation -lmylib1 -lpthread -ldl -lm
Any suggestions on how to fix this?
Thanks.