error in link to myself .so

General questions regarding the usage of CodeLite
roy
CodeLite Curious
Posts: 6
Joined: Sat Jun 19, 2010 9:32 pm
Genuine User: Yes
IDE Question: c++
Contact:

error in link to myself .so

Post by roy » Sat Jun 19, 2010 9:56 pm

hi everybody,

I am trying to create a workspace which included two projects: "exe" and "dll", my OS is Linux(Ubuntu10.04).
my steps:
1, create a empty workspace "testcldll" under "/home/roy/desktop" folder.
2, create a dynamic library (with g+++) project "dll".
3, create a console simple executable(g++) project "exe"
4, add "-fPIC" to "dll" project compile option, build "dll" project successfully, "testcl/dll/Debug/dll.so" was create.
6, add "/home/roy/desktop/testcldll/dll/Debug/" to "exe" project "Linker->Library Path", add "dll" to "Linker->Libraries"
7, build "exe" prject, failed on error:

Code: Select all

g++ -c  "/home/roy/desktop/testcldll/exe/main.cpp" -g  -o ./Debug/main.o "-I." "-I." 
g++ -o ./Debug/exe ./Debug/main.o  "-L." "-L/home/roy/desktop/testcldll/dll/Debug/"  -ldll  
/usr/bin/ld: cannot find -ldll
attached all files of this workspace:
testcldll.zip
Any advise will be appreciated.
Thanks

BTW, I have read this page,

Code: Select all

http://codelite.org/forum/viewtopic.php?f=11&t=962
, but still can't solve my problem.
You do not have the required permissions to view the files attached to this post.

User avatar
eranif
CodeLite Plugin
Posts: 6132
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: error in link to myself .so

Post by eranif » Sat Jun 19, 2010 10:35 pm

Side note:

Does the folder really named '/home/roy/desktop' ?
or maybe '/home/roy/Desktop' (uppercase D)

I did 2 changes and it links fine on my box:
1) Change the output file name from

Code: Select all

$(IntermediateDirectory)/$(ProjectName).so
into:

Code: Select all

$(IntermediateDirectory)/lib$(ProjectName).so
The linux linker requires the SO file to be prefixed with 'lib'

2) I changed the path to use Upper Case 'D' (/home/eran/Desktop)

Eran
Make sure you have read the HOW TO POST thread

roy
CodeLite Curious
Posts: 6
Joined: Sat Jun 19, 2010 9:32 pm
Genuine User: Yes
IDE Question: c++
Contact:

Re: error in link to myself .so

Post by roy » Sun Jun 20, 2010 5:22 am

Great! After changed the "Dll" output file name to "$(IntermediateDirectory)/lib$(ProjectName).so", it works now!
and I can use relative path "../dll/Debug/" for the "exe" Linker setting "Library Path" too.
Thank you very much.

my desktop folder name is really "desktop" (lowercase 'd') :lol:

Post Reply