亚洲av成人无遮挡网站在线观看,少妇性bbb搡bbb爽爽爽,亚洲av日韩精品久久久久久,兔费看少妇性l交大片免费,无码少妇一区二区三区

  免費(fèi)注冊(cè) 查看新帖 |

Chinaunix

  平臺(tái) 論壇 博客 文庫
最近訪問板塊 發(fā)新帖
查看: 5893 | 回復(fù): 6
打印 上一主題 下一主題

編譯時(shí)找不到頭文件,應(yīng)該如何處理? [復(fù)制鏈接]

論壇徽章:
0
跳轉(zhuǎn)到指定樓層
1 [收藏(0)] [報(bào)告]
發(fā)表于 2006-08-02 10:01 |只看該作者 |倒序?yàn)g覽
OS:Ubuntu 6.06
編輯器:Eclipse

不論我在Eclipse或是在命令行下編譯都不成功。

編譯命令:
gcc -o hello ./hello.c

代碼是在007xiong 的教程中抄的,如下:

#include <unistd.h>;
#include <pwd.h>;
#include <sys/types.h>;
#include <stdio.h>;
int main(int argc,char **argv)
{
pid_t my_pid,parent_pid;
uid_t my_uid,my_euid;
gid_t my_gid,my_egid;
struct passwd *my_info;
my_pid=getpid();
parent_pid=getppid();
my_uid=getuid();
my_euid=geteuid();
my_gid=getgid();
my_egid=getegid();
my_info=getpwuid(my_uid);
printf("Process ID:%ld\n",my_pid);
printf("Parent ID:%ld\n",parent_pid);
printf("User ID:%ld\n",my_uid);
printf("Effective User ID:%ld\n",my_euid);
printf("Group ID:%ld\n",my_gid);
printf("Effective Group ID:%ld\n",my_egid):
if(my_info)
{
printf("My Login Name:%s\n" ,my_info->;pw_name);
printf("My Password :%s\n" ,my_info->;pw_passwd);
printf("My User ID :%ld\n",my_info->;pw_uid);
printf("My Group ID :%ld\n",my_info->;pw_gid);
printf("My Real Name:%s\n" ,my_info->;pw_gecos);
printf("My Home Dir :%s\n", my_info->;pw_dir);
printf("My Work Shell:%s\n", my_info->;pw_shell);
}
}

論壇徽章:
0
2 [報(bào)告]
發(fā)表于 2006-08-02 10:22 |只看該作者
這里應(yīng)該不是頭文件的問題吧
  1. #include <unistd.h>;
  2. #include <pwd.h>;
  3. #include <sys/types.h>;
  4. #include <stdio.h>;
復(fù)制代碼
  1. printf("My Login Name:%s\n" ,my_info->;pw_name);
  2. printf("My Password :%s\n" ,my_info->;pw_passwd);
  3. printf("My User ID :%ld\n",my_info->;pw_uid);
  4. printf("My Group ID :%ld\n",my_info->;pw_gid);
  5. printf("My Real Name:%s\n" ,my_info->;pw_gecos);
  6. printf("My Home Dir :%s\n", my_info->;pw_dir);
  7. printf("My Work Shell:%s\n", my_info->;pw_shell);
復(fù)制代碼
都多了分號(hào)呀

論壇徽章:
0
3 [報(bào)告]
發(fā)表于 2006-08-02 14:00 |只看該作者
最簡單的:

int main(int argc,char **argv)
{
        printf("Hello linux.\n");
}

也會(huì)報(bào)錯(cuò),報(bào)錯(cuò)信息如下:
trueman@trueman:~/Desktop$ gcc -o hellow hellow.c
hellow.c: In function ‘main’:
hellow.c:3: warning: incompatible implicit declaration of built-in function ‘printf’
/usr/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status

trueman@trueman:~/Desktop$ sudo gcc -o hellow hellow.c
Password:
hellow.c: In function ‘main’:
hellow.c:3: warning: incompatible implicit declaration of built-in function ‘printf’
/usr/bin/ld: crt1.o: No such file: No such file or directory
collect2: ld returned 1 exit status

論壇徽章:
1
2015年辭舊歲徽章
日期:2015-03-03 16:54:15
4 [報(bào)告]
發(fā)表于 2006-08-02 14:05 |只看該作者
gcc 有問題了。
重裝一個(gè)吧!
crt1.o 都找不到,說明 gcc 已經(jīng)被損壞了。

  1. [flw@Sleeper ~]$ whereis crt1.o
  2. crt1: /usr/lib/crt1.o
  3. [flw@Sleeper ~]$
復(fù)制代碼

論壇徽章:
0
5 [報(bào)告]
發(fā)表于 2006-08-02 14:17 |只看該作者
flw:
    確實(shí)whereis crt1.o是什么都沒顯示,應(yīng)該文件已經(jīng)丟掉了。

論壇徽章:
0
6 [報(bào)告]
發(fā)表于 2006-08-02 14:18 |只看該作者
trueman@trueman:~/Desktop$ sudo apt-get install gcc
Reading package lists... Done
Building dependency tree... Done
gcc is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 135 not upgraded.
-------------------------------------------------------------------------------------------
我估計(jì)我只裝了gcc,類庫和gdb什么的都沒裝。但我不清楚要裝些什么。

論壇徽章:
0
7 [報(bào)告]
發(fā)表于 2006-08-02 19:06 |只看該作者
來位達(dá)人指教一下吧。
您需要登錄后才可以回帖 登錄 | 注冊(cè)

本版積分規(guī)則 發(fā)表回復(fù)

  

北京盛拓優(yōu)訊信息技術(shù)有限公司. 版權(quán)所有 京ICP備16024965號(hào)-6 北京市公安局海淀分局網(wǎng)監(jiān)中心備案編號(hào):11010802020122 niuxiaotong@pcpop.com 17352615567
未成年舉報(bào)專區(qū)
中國互聯(lián)網(wǎng)協(xié)會(huì)會(huì)員  聯(lián)系我們:huangweiwei@itpub.net
感謝所有關(guān)心和支持過ChinaUnix的朋友們 轉(zhuǎn)載本站內(nèi)容請(qǐng)注明原作者名及出處

清除 Cookies - ChinaUnix - Archiver - WAP - TOP