[問題] strrev
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
Linux Ubuntu 10.10
問題(Question):
#include<string.h>
strrev函數 編譯時錯誤
錯誤結果(Wrong Output):
gcc main.c
編譯時的錯誤訊息
main.c:(.text+0x60a): undefined reference to `strrev'
collect2: ld returned 1 exit status
程式碼(Code):(請善用置底文網頁, 記得排版)
#include<stdio.h>
#include<string.h>
int main(){
char *s="ABCD";
printf("%s",strrev(strdup(s)));
return 0;
}
照理說string.h應該有strrev這個函數
只是不知道為什麼編譯時卻發生錯誤
不知道我哪邊有錯誤 能否請各位有經驗的鄉民幫我指出來 非常感謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.114.221.148
→
02/26 00:42, , 1F
02/26 00:42, 1F
→
02/26 00:44, , 2F
02/26 00:44, 2F
→
02/26 00:45, , 3F
02/26 00:45, 3F
→
02/26 00:46, , 4F
02/26 00:46, 4F
→
02/26 00:46, , 5F
02/26 00:46, 5F
→
02/26 00:52, , 6F
02/26 00:52, 6F
→
02/26 01:00, , 7F
02/26 01:00, 7F
推
02/26 01:10, , 8F
02/26 01:10, 8F
→
02/26 01:13, , 9F
02/26 01:13, 9F
→
02/26 01:13, , 10F
02/26 01:13, 10F
→
02/26 01:28, , 11F
02/26 01:28, 11F
→
02/26 01:31, , 12F
02/26 01:31, 12F
→
02/26 01:36, , 13F
02/26 01:36, 13F