红联Linux门户
Linux帮助

请教KDevelop3.x里面如何创建.so共享库

发布时间:2008-01-23 18:50:15来源:红联作者:51563946
我使用的是kdevelop版本是3.5,也就是fedora 8里面自带的kdevelop.
关于如何生成.so文件我在官网上找到的解释是这样 :
http://www.kdevelop.org/mediawik ... te_a_.so_library.3F

How to create a .so library?
Add a target to the project
primary: program
prefix: bin
file name: libxxx
Linker Flags-> Other: -shared -Wl,-soname,libxxx.so.1 -o libxxx.so.1.0.1
However, on some systems it results in the following error message during project compilation:
-soname command not recognized.
If that happens use only -shared -o libxxx.so
Add the cpp/h files to this target
set compiler flags for c++ -fPIC
There is also a libtool based method:

Add a sub-project "libxxx"
Add a target
Choice "Library (libtool)"
Choice "lib"
Put your library name "xxx"
Add your files
Build the project (Use 'Build project' or F.
Now, you should have a new library named libxxx.so.0.0.0

这两种方法都试了,根本生成的不是.so文件.第一种按照它原本的步骤会报错.创建时在连接选项中加的-shared -WI在目标建立好后的属性中根本没有.自己由重新加了过,生成的是没有后缀名的文件.手动把它改成.so也不行.
第二种方法生成的是.la文件,还是个文本格式的.呃,对Linux下编程不熟,不知道这个libtool的.la到底是什么东西.
请教下有谁知道在Kdevelop3.5里面怎么生成.so文件啊?
文章评论

共有 1 条评论

  1. 51563946 于 2008-01-24 09:12:18发表:

    请问有人知道么?谢谢