LoveUnix » 其他UNIX & Linux » 关于在Solaris 10上 gcc编译的问题(请大家帮忙,谢谢)
让LU留住您的每

一天 让LU博客留住您的每一天
2007-8-28 08:12 xingyu820424
关于在Solaris 10上 gcc编译的问题(请大家帮忙,谢谢)

在Solaris10上自带gcc 3.4.3,
我有一个程序 appsnd6, 有自己的头文件和库文件(libapp.a)
用的用户是app用户, SHELL=/bin/sh
开始:
gcc -I/home/app/h -c appsnd6.c   能够生成appsnd6.o文件,没有问题
但在进行 ld -L/home/app/obj -lapp -o appsnd6 appsnd6.o的时候 报以下错误:
Undefined                       first referenced
symbol                             in file
exit                                appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
free                                appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
puts                                appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
stat                                appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
time                                appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
errno                               appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
fread                               appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
mkdir                               appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
app_defval                        appsnd6.o
closedir                            appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
app_stop                          appsnd6.o
app_init                          appsnd6.o
app_open                          appsnd6.o
Ctl_tr                              appsnd6.o
set_format                          appsnd6.o
opendir                             appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
fclose                              appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
fflush                              appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
getenv                              appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
fwrite                              appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
remove                              appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
strcat                              appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
strcmp                              appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
strcpy                              appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
strdup                              appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
strlen                              appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
realloc                             appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
localtime                           appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
app_rcv                           appsnd6.o
app_snd                           appsnd6.o
strncpy                             appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
tr_pdmp                             appsnd6.o
tr_pmsg                             appsnd6.o
strerror                            appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
strftime                            appsnd6.o  (symbol belongs to implicit dependency /usr/lib/libc.so.1)
app_close                         appsnd6.o
app_abort                         appsnd6.o
ld: fatal: Symbol referencing errors. No output written to appsnd6

如果我直接使用gcc -I/home/app/h -L/home/app/obj -lapp -o appsnd6 appsnd6.c命令,则以下报错信息:
Undefined                       first referenced
symbol                             in file
app_defval                        /var/tmp//cckoW6Yo.o
app_stop                          /var/tmp//cckoW6Yo.o
app_init                          /var/tmp//cckoW6Yo.o
app_open                          /var/tmp//cckoW6Yo.o
Ctl_tr                              /var/tmp//cckoW6Yo.o
set_format                          /var/tmp//cckoW6Yo.o
app_rcv                           /var/tmp//cckoW6Yo.o
app_snd                           /var/tmp//cckoW6Yo.o
tr_pdmp                             /var/tmp//cckoW6Yo.o
tr_pmsg                             /var/tmp//cckoW6Yo.o
app_close                         /var/tmp//cckoW6Yo.o
app_abort                         /var/tmp//cckoW6Yo.o
ld: fatal: Symbol referencing errors. No output written to appsnd6
collect2: ld returned 1 exit status

应该是连接库的时候,有问题,希望大家帮忙,本人万分感谢,已经想了很多办法折腾了4天了.都没解决.

2007-8-28 09:45 xingyu820424
后来又下载了一个GCC 3.4.6 for solaris 10,安装上去,设置PATH 为新安装的GCC 目录下(/usr/local/bin)
也同样遇见以上的问题

2007-8-28 14:39 xingyu820424
问题解决了,呵呵

页: [1]


Powered by Discuz! Archiver 5.5.0  © 2001-2006 Comsenz Inc.