作者king19880326 (OK的啦~我都可以接受)
看板LinuxDev
标题[问题] 想请问Advanced Programming in the UNIX Environment一书的apue.h
时间Wed Apr 2 00:39:46 2008
小弟我最近开始读Advance Programming in the UNIX Environment一书
想要嚐试code 书中的程式码
也就照着书上提供的网页 去下载了apue.h
并且解压缩编译後放在/usr/include这个资料夹中
可是在我编译程式的的时候
会出现以下的错误
/tmp/cckYAUFP.o: In function `thr_fn':
test_unix_programming.c:(.text+0xed): undefined reference to
`pthread_sigmask'
test_unix_programming.c:(.text+0x104): undefined reference to `err_sys'
/tmp/cckYAUFP.o: In function `main':
test_unix_programming.c:(.text+0x295): undefined reference to `err_quit'
test_unix_programming.c:(.text+0x2d3): undefined reference to `err_quit'
test_unix_programming.c:(.text+0x327): undefined reference to `err_sys'
test_unix_programming.c:(.text+0x35f): undefined reference to
`pthread_create'
test_unix_programming.c:(.text+0x37b): undefined reference to `err_exit'
test_unix_programming.c:(.text+0x3b3): undefined reference to
`pthread_sigmask'
test_unix_programming.c:(.text+0x3c3): undefined reference to `err_sys'
collect2: ld 回传 1
可是我去看 apue.h 里面 ,都有这些函式
不知道是那里出现了问题
希望各位大大指点一下 告诉我该怎麽样才能使用apue.h @@
感谢大家<(_ _)>
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.112.243.43
※ 编辑: king19880326 来自: 140.112.243.43 (04/02 00:42)
※ 编辑: king19880326 来自: 140.112.243.43 (04/02 00:47)
1F:推 elpam:麻烦先告知一下你的unix是那一套 04/02 02:33
2F:→ king19880326:现在可以了 可是必须要在编译时加上-lm 函式库位置 04/02 02:35
3F:→ king19880326:有什麽方法可以让gcc自动找到他吗??我是用Ubuntu7.10 04/02 02:36
4F:推 elpam: = = 什麽叫自动找到他 ....请了解gcc是什麽-lm又是什麽 04/02 15:13
5F:→ elpam:你的问题请写makefile 04/02 15:14