免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3015 | 回复: 2
打印 上一主题 下一主题

请教编译出错的问题! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-08-07 11:08 |只看该作者 |倒序浏览
pthread_create,pthread_exit是poxis的标准函数,可是在aix下面的cc编译器老是出问题!!!!!!      \r\n原程序如下: \r\n#include <pthread.h>;    /* include file for pthreads - the 1st */\r\n#include <stdio.h>;      /* include file for printf()           */\r\n#include <unistd.h>;     /* include file for sleep()            */\r\n\r\nvoid *Thread(void *string)\r\n{\r\n        while (1)\r\n                printf(\"%s\\n\", (char *)string);\r\n        pthread_exit(NULL);\r\n}\r\n\r\nint main()\r\n{\r\n        char *e_str = \"Hello!\";\r\n        char *f_str = \"Bonjour !\";\r\n\r\n        pthread_t e_th;\r\n        pthread_t f_th;\r\n\r\n        int rc;\r\n\r\n        rc = pthread_create(&e_th, NULL, Thread, (void *)e_str);\r\n        if (rc)\r\n                exit(-1);\r\n        rc = pthread_create(&f_th, NULL, Thread, (void *)f_str);\r\n        if (rc)\r\n                exit(-1);\r\n        sleep(5);\r\n\r\n        /* usually the exit subroutine should not be used\r\n           see below to get more information */\r\n        exit(0);\r\n}     \r\n编译时提示:\r\n\r\nld: 0711-317 ERROR: Undefined symbol: .pthread_create\r\nld: 0711-317 ERROR: Undefined symbol: .pthread_exit\r\nld: 0711-345 Use the -bloadmap or -bnoquiet option to obtain more information.\r\n\r\n加 -bnoquiet 选项时编译信息提示如下:\r\n$ cc -o pthreadtest pthreadtest.c -bnoquiet\r\n(ld): halt 4\r\n(ld): lrgpage 0\r\n(ld): savename pthreadtest\r\n(ld): filelist 4 1\r\n(ld): i /lib/crt0.o\r\n(ld): i pthreadtest.o\r\n(ld): lib /usr/lib/libxlopt.a\r\n(ld): lib /usr/lib/libc.a\r\nLIBRARY: Shared object libc.a[shr.o]: 2379 symbols imported.\r\nLIBRARY: Shared object libc.a[meth.o]: 2 symbols imported.\r\nLIBRARY: Shared object libc.a[aio.o]: 11 symbols imported.\r\nLIBRARY: Shared object libc.a[pse.o]: 4 symbols imported.\r\nLIBRARY: Shared object libc.a[dl.o]: 4 symbols imported.\r\nLIBRARY: Shared object libc.a[pty.o]: 1 symbols imported.\r\nFILELIST: Number of previously inserted files processed: 4\r\n(ld): resolve\r\nRESOLVE: 41 of 3024 symbols were kept.\r\n(ld): addgl /usr/lib/glink.o\r\nADDGL: Glink code added for 6 symbols.\r\n(ld): er full\r\nld: 0711-318 ERROR: Undefined symbols were found.\r\n        The following symbols are in error:\r\n Symbol                    Inpndx  TY CL Source-File(Object-File) OR Import-File{Shared-object}\r\n                              RLD: Address  Section  Rld-type Referencing Symbol\r\n ----------------------------------------------------------------------------------------------\r\n .pthread_create           [30]    ER PR pthreadtest.c(pthreadtest.o)\r\n                                   00000034 .text    R_RBR    [12]    .main\r\n                                   00000064 .text    R_RBR    [12]    .main\r\n .pthread_exit             [38]    ER PR pthreadtest.c(pthreadtest.o)\r\n                                   000000fc .text    R_RBR    [14]    .Thread\r\nER: The return code is 8.\r\n$

论坛徽章:
0
2 [报告]
发表于 2003-08-07 14:39 |只看该作者

请教编译出错的问题!

什么编译器、什么版本

论坛徽章:
0
3 [报告]
发表于 2003-08-07 14:53 |只看该作者

请教编译出错的问题!

AIX UNIX 5.1.0.0 下的c编译器 cc ,编译器的版本号为6.0
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP