[root@localhost ~]#
[root@localhost ~]# $vi test.c
bash: test.c: command not found
[root@localhost ~]# gcc
gcc: 没有输入文件
[root@localhost ~]# $date
[root@localhost ~]# $ date
bash: $: command not found
[root@localhost ~]# $
bash: $: command not found
[root@localhost ~]# gcc test.c
gcc: test.c:没有那个文件或目录
gcc: 没有输入文件
[root@localhost ~]# gcc e:/test.c
gcc: e:/test.c:没有那个文件或目录
gcc: 没有输入文件
[root@localhost ~]# gcc /mnt/hda3/test.c
[root@localhost ~]# echo $SHELL
/bin/bash
[root@localhost ~]# command>test.c
[root@localhost ~]# command
[root@localhost ~]# ls
anaconda-ks.cfg Desktop install.log.syslog test.c
a.out install.log My Documents 下载
[root@localhost ~]# ./a.out
Hello,world!
[root@localhost ~]# gcc /mnt/hda3/test.c
[root@localhost ~]# ./a.out
good boys!
Hello,world!
[root@localhost ~]# gcc /mnt/hda3/test.c
[root@localhost ~]# gcc -o test test.cd
gcc: test.cd:没有那个文件或目录
gcc: 没有输入文件
[root@localhost ~]# gcc -o test /mnt/hda3/test.c
[root@localhost ~]# ./a.out
good boys!
Hello,world!
[root@localhost ~]# ./test.out
bash: ./test.out: 没有那个文件或目录
[root@localhost ~]# ./test
good boys!
Hello,world!
[root@localhost ~]# gdb
GNU gdb Fedora (6.8-24)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redflag-linux".
(gdb)
(gdb) run
Starting program:
No executable file specified.
Use the "file" or "exec-file" command.
(gdb) /mnt/hda3/test.c
Undefined command: "". Try "help".
(gdb) help
List of classes of commands:
aliases -- Aliases of other commands
breakpoints -- Making program stop at certain points
data -- Examining data
files -- Specifying and examining files
internals -- Maintenance commands
obscure -- Obscure features
running -- Running the program
stack -- Examining the stack
status -- Status inquiries
support -- Support facilities
tracepoints -- Tracing of program execution without stopping the program
user-defined -- User-defined commands
Type "help" followed by a class name for a list of commands in that class.
Type "help all" for the list of all commands.
Type "help" followed by command name for full documentation.
Type "apropos word" to search for commands related to "word".
Command name abbreviations are allowed if unambiguous.
(gdb) files /mnt/hda3/test.c
Undefined command: "files". Try "help".
(gdb) file /mnt/hda3/test.c
"/mnt/hda3/test.c": not in executable format: File format not recognized
(gdb) quit
[root@localhost ~]# gcc -ggdb -o test /mnt/hda3/test.c
[root@localhost ~]# gdb test
GNU gdb Fedora (6.8-24)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redflag-linux"...
(gdb) run
Starting program: /root/test
good boys!
Hello,world!
Program exited with code 015.
(gdb) list
1
2 #include <stdio.h>
3
4 main( )
5 {
6 printf("good boys!\n");
7 printf("Hello,world!\n");
8 }
(gdb) step
The program is not being run.
(gdb) run
Starting program: /root/test
good boys!
Hello,world!
Program exited with code 015.
(gdb) step
The program is not being run.
(gdb) quit
[root@localhost ~]# gcc -ggdb -o test /mnt/hda3/test.c
[root@localhost ~]# gdb
GNU gdb Fedora (6.8-24)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redflag-linux".
(gdb) step
The program is not being run.
(gdb) next
The program is not being run.
(gdb) watch
Argument required (expression to compute).
(gdb) quit
[root@localhost ~]# cd
[root@localhost ~]# cd /mnt/hda3
[root@localhost hda3]# gcc test.c
[root@localhost hda3]# ./a.out
good boys!
Hello,world!
[root@localhost hda3]# ./tes
bash: ./tes: 没有那个文件或目录
[root@localhost hda3]# ./test
bash: ./test: 没有那个文件或目录
[root@localhost hda3]# gcc test.c
[root@localhost hda3]# ./a.out
good boys!
Hello,world!
[root@localhost hda3]# gcc -o test test.c
[root@localhost hda3]# ./test
good boys!
Hello,world!
[root@localhost hda3]# gcc -ggdb -o test test.c
[root@localhost hda3]# gdb
GNU gdb Fedora (6.8-24)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redflag-linux".
(gdb) quit
[root@localhost hda3]# gcc tet.c
gcc: tet.c:没有那个文件或目录
gcc: 没有输入文件
[root@localhost hda3]# gcc test.c
[root@localhost hda3]# ./a.out
result[1-100] = 5050 /nresult[1-250] = 31125 /n[root@localhost hda3]# gcc -o test test.c
[root@localhost hda3]# ./test
result[1-100] = 5050
result[1-250] = 31125
[root@localhost hda3]# gcc -ggdb -o test test.c
[root@localhost hda3]# gdb
GNU gdb Fedora (6.8-24)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redflag-linux".
(gdb) l
No symbol table is loaded. Use the "file" command.
(gdb) list
No symbol table is loaded. Use the "file" command.
(gdb) file
No executable file now.
No symbol file now.
(gdb) run
Starting program:
No executable file specified.
Use the "file" or "exec-file" command.
(gdb) quit
[root@localhost hda3]# gdb test
GNU gdb Fedora (6.8-24)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i386-redflag-linux"...
(gdb) list
19 sum+=i;
20 }
21 return sum;
22 }
23
24
25 main()
26 {
27 int i;
28 long result = 0;
(gdb) break 16
Breakpoint 1 at 0x804837a: file test.c, line 16.
(gdb) break func
Note: breakpoint 1 also set at pc 0x804837a.
Breakpoint 2 at 0x804837a: file test.c, line 16.
(gdb) info break
Num Type Disp Enb Address What
1 breakpoint keep y 0x0804837a in func at test.c:16
2 breakpoint keep y 0x0804837a in func at test.c:16
(gdb) quit
[root@localhost hda3]# gcc -o cprocess cprocess.c
cprocess.c: 在函数‘main’中:
cprocess.c:5: 错误:expected expression before ‘=’ token
cprocess.c:6: 错误:expected expression before ‘=’ token
cprocess.c:10: 错误:expected expression before ‘=’ token
[root@localhost hda3]# gcc -o cprocess cprocess.c
[root@localhost hda3]# ./cprocess
bca[root@localhost hda3]# gcc -o cprocess cprocess.c
[root@localhost hda3]# ./cprocess
bc
a
[root@localhost hda3]# gcc -o cprocess2 cprocess2.c
cprocess2.c: 在函数‘main’中:
cprocess2.c:5: 错误:expected expression before ‘=’ token
cprocess2.c:6: 错误:expected expression before ‘=’ token
cprocess2.c:11: 错误:expected expression before ‘=’ token
cprocess2.c:12: 错误:expected expression before ‘=’ token
[root@localhost hda3]# gcc -o cprocess2 cprocess2.c
[root@localhost hda3]# cprocess2
bash: cprocess2: command not found
[root@localhost hda3]# ./cprocess2
daughter 0
daughter 1
daughter 2
daughter 3
daughter 4
daughter 5
daughter 6
daughter 7
daughter 8
daughter 9
son 0
son 1
son 2
son 3
son 4
son 5
son 6
son 7
son 8
son 9
parent 0
parent 1
parent 2
parent 3
parent 4
parent 5
parent 6
parent 7
parent 8
parent 9
[root@localhost hda3]#
Linux 初学helloword
最新推荐文章于 2024-10-22 08:49:18 发布