您的位置:程序门 -> c/c++ -> c++ 语言



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


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


请教kdevelop3.x里面如何创建.so共享库
发表于:2008-01-19 18:11:12 楼主
我使用的是fedora   8里面自带的kdevelop.发现在automake   manager的添加新目标里面怎么也找不到生成.so的选项目.查了半天用户手册貌似也没有这方面的说明.google半天无果.求助在kdevelop3.x中怎么样生成.so,谢谢了
发表于:2008-01-23 10:23:181楼 得分:0
那个kdevelop版本是3.5的.我在官网上找到的解释是这样   :
http://www.kdevelop.org/mediawiki/index.php/faq#how_to_create_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   f8).  
now,   you   should   have   a   new   library   named   libxxx.so.0.0.0  

这两种方法都试了,根本生成的不是.so文件.第一种按照它原本的步骤会报错.创建时在连接选项中加的-shared   -wi在目标建立好后的属性中根本没有.自己由重新加了过,生成的是没有后缀名的文件.手动把它改成.so也不行.
第二种方法生成的是.la文件,还是个文本格式的.呃,对linux下编程不熟,不知道这个libtool的.la到底是什么东西.
请教下有谁知道在kdevelop3.5里面怎么生成.so文件啊?
发表于:2008-01-23 18:40:172楼 得分:0
请问有人知道么?谢谢
发表于:2008-01-23 21:42:223楼 得分:0
这个没用过,用gcc直接生成不行吗?
发表于:2008-01-23 22:23:374楼 得分:0
如果用gcc,那么用makefile或者automake什么的.只是工程比较大,有很多动态库,可执行文件,测试程序什么的.互相依赖连接又比较复杂,添加个文件或者添加个生成目标都要去改makefile什么的太过麻烦.
不过kdevelop这里生成.so库还是没搞明白.


快速检索

最新资讯
热门点击