亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区
Chinaunix
標題:
詭異,HP-UX GCC不能鏈接自定義庫!
[打印本頁]
作者:
sculida
時間:
2014-01-16 19:12
標題:
詭異,HP-UX GCC不能鏈接自定義庫!
本帖最后由 sculida 于 2014-01-16 19:23 編輯
首先非常感謝各位前輩花時間瀏覽我的問題!
---------------------------------------------------
本機環(huán)境
HP-UX test02 B.11.11 U 9000/800 1106434635 unlimited-user license
gcc版本
Reading specs from /usr/local/lib/gcc/hppa2.0w-hp-hpux11.11/3.4.2/specs
Configured with: /scratch/njs/pkgbuild/3.3.1/hpux-11/gcc-3.4.2/configure --enable-languages=c,c++ --enable-threads=posix --disable-nls --with-gnu-as --without-gnu-ld --with-as=/usr/local/bin/as --with-ld=/usr/ccs/bin/ld --with-libiconv-prefix=/usr/local --prefix=/usr/local
Thread model: posix
gcc version 3.4.2
-------------------------------------------------
源代碼部分
asdf.h
#ifndef ASDF_H
#define ASDF_H
void print();
#endif
asdf.c
#include "asdf.c"
#include <stdio.h>
void print() {printf("just pirnt\n");}
main.c
#include "asdf.h"
int main() {print();return 0;}
----------------------------------------------------------------------
編譯語句
gcc -c main.c
gcc -c -fPIC asdf.c
gcc -shared -fPIC asdf.o -o libasdf.so
這三句都沒問題,但是,接下來
gcc main.o -o main -L. -lasdf
提示出錯
/usr/ccs/bin/ld: Can't find library: "asdf"
collect2: ld returned 1 exit status
不過,這樣倒是可以的
gcc main.o libasdf.so -o main
----------------------------------------------------------------------
提問,紅字那里我使用linux gcc就可以編譯成功,不知這個hpux gcc怎么就不行,要不然是什么參數(shù)沒設(shè)置好的原因。
想請高手指點一二。我怎樣才能在這臺hpux上使用自定義動態(tài)庫。不勝感謝!
作者:
吳楚客
時間:
2014-01-16 22:54
你把這兩句:
gcc -c -fPIC asdf.c
gcc -shared -fPIC asdf.o -o libasdf.so
合并成一句:
gcc -shared -fPIC asdf.c -o libasdf.so
試試看。
作者:
sculida
時間:
2014-01-17 08:50
回復(fù)
2#
吳楚客
謝謝吳楚客前輩。這樣的我已經(jīng)試過了,在最后一步鏈接的時候,依然是提示
/usr/ccs/bin/ld: Can't find library: "asdf"
collect2: ld returned 1 exit status
作者:
duanlin
時間:
2014-01-17 09:14
用
file libasdf.so
看看這個文件是不是一個真的.so。懷疑你的這個文件雖然擴展名.so,但內(nèi)容是個靜態(tài).o
作者:
sculida
時間:
2014-01-17 15:12
回復(fù)
4#
duanlin
謝謝!但是怎么查看該文件是否是一個庫文件呢?
歡迎光臨 Chinaunix (http://72891.cn/)
Powered by Discuz! X3.2