zhao@zhao-VirtualBox:~$ gcc -E a.c -o a.i
gcc: 错误: a.c:没有那个文件或目录
gcc: 致命错误: 没有输入文件
编译中断。
zhao@zhao-VirtualBox:~$ cd workspace
zhao@zhao-VirtualBox:~/workspace$ gcc -E a.c -o a.i
zhao@zhao-VirtualBox:~/workspace$ gcc -S a.i -o a.s
zhao@zhao-VirtualBox:~/workspace$ gcc -c a.s -o a.o
zhao@zhao-VirtualBox:~/workspace$ gcc a.o -o a
zhao@zhao-VirtualBox:~/workspace$ ./a
qqqqqqqqqqqqqqqqqzhao@zhao-VirtualBox:~/workspace$ gcc -c b.c
zhao@zhao-VirtualBox:~/workspace$ ar rcsv libpow.a b.o
a - b.o
zhao@zhao-VirtualBox:~/workspace$ gcc -o c c.c -L. libpow
gcc: 错误: libpow:没有那个文件或目录
zhao@zhao-VirtualBox:~/workspace$ gcc -o c c.c -L. lpow
gcc: 错误: lpow:没有那个文件或目录
zhao@zhao-VirtualBox:~/workspace$ gcc -o c c.c -L. libpow.a
c.c: 在函数‘main’中:
c.c:15:5: 警告: 格式 ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long long unsigned int’ [-Wformat]
zhao@zhao-VirtualBox:~/workspace$ ./c 2 10
2 ^ 10 = 1024
zhao@zhao-VirtualBox:~/workspace$ gcc -fPIC -Wall -c b.c
zhao@zhao-VirtualBox:~/workspace$ gcc -shared -o libpow.so b.o
zhao@zhao-VirtualBox:~/workspace$ gcc -o c c.c -L. libpow.so
c.c: 在函数‘main’中:
c.c:15:5: 警告: 格式 ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long long unsigned int’ [-Wformat]
zhao@zhao-VirtualBox:~/workspace$ sudo cp libpow.so /usr/lib
[sudo] password for zhao:
zhao@zhao-VirtualBox:~/workspace$ ./c 2 10
2 ^ 10 = 1024
zhao@zhao-VirtualBox:~/workspace$ gcc -ansi d.c -o d
zhao@zhao-VirtualBox:~/workspace$ ./d
this is a bad code
zhao@zhao-VirtualBox:~/workspace$ gcc -ansi d.c -o d
d.c: 在函数‘main’中:
d.c:5:1: 警告: 在无返回值的函数中,‘return’带返回值 [默认启用]
zhao@zhao-VirtualBox:~/workspace$ ./d
this is a bad code
zhao@zhao-VirtualBox:~/workspace$ gcc -pedantic d.c -o d
d.c:2:6: 警告: ‘main’的返回类型不是‘int’ [-Wmain]
d.c: 在函数‘main’中:
d.c:3:6: 警告: ISO C90 不支持‘long long’ [-Wlong-long]
d.c:5:1: 警告: 在无返回值的函数中,‘return’带返回值 [默认启用]
zhao@zhao-VirtualBox:~/workspace$ gcc -Wall d.c -o d
d.c:2:6: 警告: ‘main’的返回类型不是‘int’ [-Wmain]
d.c: 在函数‘main’中:
d.c:5:1: 警告: 在无返回值的函数中,‘return’带返回值 [默认启用]
d.c:3:11: 警告: 未使用的变量‘tmp’ [-Wunused-variable]
zhao@zhao-VirtualBox:~/workspace$ gcc -g e.c -o e
zhao@zhao-VirtualBox:~/workspace$ gdb e
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 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 "i686-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/zhao/workspace/e...done.
(gdb) b 6
Breakpoint 1 at 0x8048401: file e.c, line 6.
(gdb) info b
Num Type Disp Enb Address What
1 breakpoint keep y 0x08048401 in main at e.c:6
(gdb) b 19
No line 19 in the current file.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 2 (19) pending.
(gdb) c
The program is not being run.
(gdb) bt
No stack.
(gdb) ./e
Undefined command: "". Try "help".
(gdb) b 10
Breakpoint 3 at 0x8048434: file e.c, line 10.
(gdb) c
The program is not being run.
(gdb) bt
No stack.
(gdb) r
Starting program: /home/zhao/workspace/e
1~m is = 1275
Breakpoint 1, main () at e.c:6
6 for(i=1;i<=50;i++){
(gdb) c
Continuing.
dfkjsd;fjsdf is 1275
Breakpoint 3, main () at e.c:10
10 }
(gdb) bt
#0 main () at e.c:10
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/zhao/workspace/e
1~m is = 1275
Breakpoint 1, main () at e.c:6
6 for(i=1;i<=50;i++){
(gdb) info b
Num Type Disp Enb Address What
1 breakpoint keep y 0x08048401 in main at e.c:6
breakpoint already hit 1 time
2 breakpoint keep y <PENDING> 19
3 breakpoint keep y 0x08048434 in main at e.c:10
(gdb) c
Continuing.
dfkjsd;fjsdf is 1275
Breakpoint 3, main () at e.c:10
10 }
(gdb) bt
#0 main () at e.c:10
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/zhao/workspace/e
1~m is = 1275
Breakpoint 1, main () at e.c:6
6 for(i=1;i<=50;i++){
(gdb) p n
$1 = 0
(gdb) p i
$2 = 134513801
(gdb) n
7 n+=i;
(gdb) s
6 for(i=1;i<=50;i++){
(gdb) c
Continuing.
dfkjsd;fjsdf is 1275
Breakpoint 3, main () at e.c:10
10 }
(gdb) p n
$3 = 1275
(gdb) p i
$4 = 51
(gdb) n
0x0014c4d3 in __libc_start_main () from /lib/i386-linux-gnu/libc.so.6
(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) help call
Call a function in the program.
The argument is the function name and arguments, in the notation of the
current working language. The result is printed and saved in the value
history, if it is not void.
(gdb) exit
Undefined command: "exit". Try "help".
(gdb) q
A debugging session is active.
Inferior 1 [process 2868] will be killed.
Quit anyway? (y or n) y
Quitting: /home/zhao/workspace/e: 没有那个文件或目录.
zhao@zhao-VirtualBox:~/workspace$ gcc -o b.c c.c d.c e.c
c.c: 在函数‘main’中:
c.c:15:5: 警告: 格式 ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long long unsigned int’ [-Wformat]
d.c: 在函数‘main’中:
d.c:5:1: 警告: 在无返回值的函数中,‘return’带返回值 [默认启用]
/tmp/cckMl4e9.o: In function `main':
d.c:(.text+0x0): multiple definition of `main'
/tmp/ccpyGKo3.o:c.c:(.text+0x0): first defined here
/tmp/ccpl2aUf.o: In function `main':
e.c:(.text+0x0): multiple definition of `main'
/tmp/ccpyGKo3.o:c.c:(.text+0x0): first defined here
/tmp/ccpyGKo3.o: In function `main':
c.c:(.text+0x85): undefined reference to `unsgn_pow'
collect2: ld 返回 1
zhao@zhao-VirtualBox:~/workspace$ hello.o:hello.c hello.h
hello.o:hello.c:未找到命令
zhao@zhao-VirtualBox:~/workspace$ hello.o:hello.c hello.h
hello.h hello.h~
zhao@zhao-VirtualBox:~/workspace$ hello.o:hello.c hello.h
hello.o:hello.c:未找到命令
zhao@zhao-VirtualBox:~/workspace$
Display all 2362 possibilities? (y or n)
zhao@zhao-VirtualBox:~/workspace$ hello.o:hello.c hello.h
hello.o:hello.c:未找到命令
zhao@zhao-VirtualBox:~/workspace$ gcc -c hello.c -o hello.o
zhao@zhao-VirtualBox:~/workspace$ make
make: *** 没有指明目标并且找不到 makefile。 停止。
zhao@zhao-VirtualBox:~/workspace$ make hello.o
make: “hello.o”是最新的。
zhao@zhao-VirtualBox:~/workspace$ ls
a a.c~ a.o b.c~ c.c~ d.c~ e.c~ hello.c~ hello.h Hello.java~ libpow.so
a.c a.i a.s c.c d.c e.c hello.c Hello.c~ hello.h~ hello.o 未命名文件夹
zhao@zhao-VirtualBox:~/workspace$ make
make: *** 没有指明目标并且找不到 makefile。 停止。
zhao@zhao-VirtualBox:~/workspace$ make
gcc -c hello.c -o hello.o
zhao@zhao-VirtualBox:~/workspace$ ls
a a.i b.c~ d.c e.c~ Hello.c~ Hello.java~ makefile
a.c a.o c.c d.c~ hello.c hello.h hello.o makefile~
a.c~ a.s c.c~ e.c hello.c~ hello.h~ libpow.so 未命名文件夹
zhao@zhao-VirtualBox:~/workspace$ ./hello.o
bash: ./hello.o: 权限不够
zhao@zhao-VirtualBox:~/workspace$ ./hello.c
bash: ./hello.c: 权限不够
zhao@zhao-VirtualBox:~/workspace$ make
make: *** 没有规则可以创建“test.o”需要的目标“test.c”。 停止。
zhao@zhao-VirtualBox:~/workspace$ make
gcc -c hello.c
make: *** 没有规则可以创建“test2.o”需要的目标“hello2.c”。 停止。
zhao@zhao-VirtualBox:~/workspace$ make
make: *** 没有规则可以创建“appexam”需要的目标“test.o”。 停止。
zhao@zhao-VirtualBox:~/workspace$ make
make: *** 没有规则可以创建“hello2.o”需要的目标“hello2.c”。 停止。
zhao@zhao-VirtualBox:~/workspace$ make
gcc -c hello2.c
gcc -c hello3.c
gcc -o appexam hello.o hello2.o hello3.o
hello2.o: In function `main':
hello2.c:(.text+0x0): multiple definition of `main'
hello.o:hello.c:(.text+0x0): first defined here
hello3.o: In function `main':
hello3.c:(.text+0x0): multiple definition of `main'
hello.o:hello.c:(.text+0x0): first defined here
collect2: ld 返回 1
make: *** [appexam] 错误 1
zhao@zhao-VirtualBox:~/workspace$
gcc: 错误: a.c:没有那个文件或目录
gcc: 致命错误: 没有输入文件
编译中断。
zhao@zhao-VirtualBox:~$ cd workspace
zhao@zhao-VirtualBox:~/workspace$ gcc -E a.c -o a.i
zhao@zhao-VirtualBox:~/workspace$ gcc -S a.i -o a.s
zhao@zhao-VirtualBox:~/workspace$ gcc -c a.s -o a.o
zhao@zhao-VirtualBox:~/workspace$ gcc a.o -o a
zhao@zhao-VirtualBox:~/workspace$ ./a
qqqqqqqqqqqqqqqqqzhao@zhao-VirtualBox:~/workspace$ gcc -c b.c
zhao@zhao-VirtualBox:~/workspace$ ar rcsv libpow.a b.o
a - b.o
zhao@zhao-VirtualBox:~/workspace$ gcc -o c c.c -L. libpow
gcc: 错误: libpow:没有那个文件或目录
zhao@zhao-VirtualBox:~/workspace$ gcc -o c c.c -L. lpow
gcc: 错误: lpow:没有那个文件或目录
zhao@zhao-VirtualBox:~/workspace$ gcc -o c c.c -L. libpow.a
c.c: 在函数‘main’中:
c.c:15:5: 警告: 格式 ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long long unsigned int’ [-Wformat]
zhao@zhao-VirtualBox:~/workspace$ ./c 2 10
2 ^ 10 = 1024
zhao@zhao-VirtualBox:~/workspace$ gcc -fPIC -Wall -c b.c
zhao@zhao-VirtualBox:~/workspace$ gcc -shared -o libpow.so b.o
zhao@zhao-VirtualBox:~/workspace$ gcc -o c c.c -L. libpow.so
c.c: 在函数‘main’中:
c.c:15:5: 警告: 格式 ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long long unsigned int’ [-Wformat]
zhao@zhao-VirtualBox:~/workspace$ sudo cp libpow.so /usr/lib
[sudo] password for zhao:
zhao@zhao-VirtualBox:~/workspace$ ./c 2 10
2 ^ 10 = 1024
zhao@zhao-VirtualBox:~/workspace$ gcc -ansi d.c -o d
zhao@zhao-VirtualBox:~/workspace$ ./d
this is a bad code
zhao@zhao-VirtualBox:~/workspace$ gcc -ansi d.c -o d
d.c: 在函数‘main’中:
d.c:5:1: 警告: 在无返回值的函数中,‘return’带返回值 [默认启用]
zhao@zhao-VirtualBox:~/workspace$ ./d
this is a bad code
zhao@zhao-VirtualBox:~/workspace$ gcc -pedantic d.c -o d
d.c:2:6: 警告: ‘main’的返回类型不是‘int’ [-Wmain]
d.c: 在函数‘main’中:
d.c:3:6: 警告: ISO C90 不支持‘long long’ [-Wlong-long]
d.c:5:1: 警告: 在无返回值的函数中,‘return’带返回值 [默认启用]
zhao@zhao-VirtualBox:~/workspace$ gcc -Wall d.c -o d
d.c:2:6: 警告: ‘main’的返回类型不是‘int’ [-Wmain]
d.c: 在函数‘main’中:
d.c:5:1: 警告: 在无返回值的函数中,‘return’带返回值 [默认启用]
d.c:3:11: 警告: 未使用的变量‘tmp’ [-Wunused-variable]
zhao@zhao-VirtualBox:~/workspace$ gcc -g e.c -o e
zhao@zhao-VirtualBox:~/workspace$ gdb e
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 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 "i686-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /home/zhao/workspace/e...done.
(gdb) b 6
Breakpoint 1 at 0x8048401: file e.c, line 6.
(gdb) info b
Num Type Disp Enb Address What
1 breakpoint keep y 0x08048401 in main at e.c:6
(gdb) b 19
No line 19 in the current file.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 2 (19) pending.
(gdb) c
The program is not being run.
(gdb) bt
No stack.
(gdb) ./e
Undefined command: "". Try "help".
(gdb) b 10
Breakpoint 3 at 0x8048434: file e.c, line 10.
(gdb) c
The program is not being run.
(gdb) bt
No stack.
(gdb) r
Starting program: /home/zhao/workspace/e
1~m is = 1275
Breakpoint 1, main () at e.c:6
6 for(i=1;i<=50;i++){
(gdb) c
Continuing.
dfkjsd;fjsdf is 1275
Breakpoint 3, main () at e.c:10
10 }
(gdb) bt
#0 main () at e.c:10
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/zhao/workspace/e
1~m is = 1275
Breakpoint 1, main () at e.c:6
6 for(i=1;i<=50;i++){
(gdb) info b
Num Type Disp Enb Address What
1 breakpoint keep y 0x08048401 in main at e.c:6
breakpoint already hit 1 time
2 breakpoint keep y <PENDING> 19
3 breakpoint keep y 0x08048434 in main at e.c:10
(gdb) c
Continuing.
dfkjsd;fjsdf is 1275
Breakpoint 3, main () at e.c:10
10 }
(gdb) bt
#0 main () at e.c:10
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/zhao/workspace/e
1~m is = 1275
Breakpoint 1, main () at e.c:6
6 for(i=1;i<=50;i++){
(gdb) p n
$1 = 0
(gdb) p i
$2 = 134513801
(gdb) n
7 n+=i;
(gdb) s
6 for(i=1;i<=50;i++){
(gdb) c
Continuing.
dfkjsd;fjsdf is 1275
Breakpoint 3, main () at e.c:10
10 }
(gdb) p n
$3 = 1275
(gdb) p i
$4 = 51
(gdb) n
0x0014c4d3 in __libc_start_main () from /lib/i386-linux-gnu/libc.so.6
(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) help call
Call a function in the program.
The argument is the function name and arguments, in the notation of the
current working language. The result is printed and saved in the value
history, if it is not void.
(gdb) exit
Undefined command: "exit". Try "help".
(gdb) q
A debugging session is active.
Inferior 1 [process 2868] will be killed.
Quit anyway? (y or n) y
Quitting: /home/zhao/workspace/e: 没有那个文件或目录.
zhao@zhao-VirtualBox:~/workspace$ gcc -o b.c c.c d.c e.c
c.c: 在函数‘main’中:
c.c:15:5: 警告: 格式 ‘%u’ expects argument of type ‘unsigned int’, but argument 4 has type ‘long long unsigned int’ [-Wformat]
d.c: 在函数‘main’中:
d.c:5:1: 警告: 在无返回值的函数中,‘return’带返回值 [默认启用]
/tmp/cckMl4e9.o: In function `main':
d.c:(.text+0x0): multiple definition of `main'
/tmp/ccpyGKo3.o:c.c:(.text+0x0): first defined here
/tmp/ccpl2aUf.o: In function `main':
e.c:(.text+0x0): multiple definition of `main'
/tmp/ccpyGKo3.o:c.c:(.text+0x0): first defined here
/tmp/ccpyGKo3.o: In function `main':
c.c:(.text+0x85): undefined reference to `unsgn_pow'
collect2: ld 返回 1
zhao@zhao-VirtualBox:~/workspace$ hello.o:hello.c hello.h
hello.o:hello.c:未找到命令
zhao@zhao-VirtualBox:~/workspace$ hello.o:hello.c hello.h
hello.h hello.h~
zhao@zhao-VirtualBox:~/workspace$ hello.o:hello.c hello.h
hello.o:hello.c:未找到命令
zhao@zhao-VirtualBox:~/workspace$
Display all 2362 possibilities? (y or n)
zhao@zhao-VirtualBox:~/workspace$ hello.o:hello.c hello.h
hello.o:hello.c:未找到命令
zhao@zhao-VirtualBox:~/workspace$ gcc -c hello.c -o hello.o
zhao@zhao-VirtualBox:~/workspace$ make
make: *** 没有指明目标并且找不到 makefile。 停止。
zhao@zhao-VirtualBox:~/workspace$ make hello.o
make: “hello.o”是最新的。
zhao@zhao-VirtualBox:~/workspace$ ls
a a.c~ a.o b.c~ c.c~ d.c~ e.c~ hello.c~ hello.h Hello.java~ libpow.so
a.c a.i a.s c.c d.c e.c hello.c Hello.c~ hello.h~ hello.o 未命名文件夹
zhao@zhao-VirtualBox:~/workspace$ make
make: *** 没有指明目标并且找不到 makefile。 停止。
zhao@zhao-VirtualBox:~/workspace$ make
gcc -c hello.c -o hello.o
zhao@zhao-VirtualBox:~/workspace$ ls
a a.i b.c~ d.c e.c~ Hello.c~ Hello.java~ makefile
a.c a.o c.c d.c~ hello.c hello.h hello.o makefile~
a.c~ a.s c.c~ e.c hello.c~ hello.h~ libpow.so 未命名文件夹
zhao@zhao-VirtualBox:~/workspace$ ./hello.o
bash: ./hello.o: 权限不够
zhao@zhao-VirtualBox:~/workspace$ ./hello.c
bash: ./hello.c: 权限不够
zhao@zhao-VirtualBox:~/workspace$ make
make: *** 没有规则可以创建“test.o”需要的目标“test.c”。 停止。
zhao@zhao-VirtualBox:~/workspace$ make
gcc -c hello.c
make: *** 没有规则可以创建“test2.o”需要的目标“hello2.c”。 停止。
zhao@zhao-VirtualBox:~/workspace$ make
make: *** 没有规则可以创建“appexam”需要的目标“test.o”。 停止。
zhao@zhao-VirtualBox:~/workspace$ make
make: *** 没有规则可以创建“hello2.o”需要的目标“hello2.c”。 停止。
zhao@zhao-VirtualBox:~/workspace$ make
gcc -c hello2.c
gcc -c hello3.c
gcc -o appexam hello.o hello2.o hello3.o
hello2.o: In function `main':
hello2.c:(.text+0x0): multiple definition of `main'
hello.o:hello.c:(.text+0x0): first defined here
hello3.o: In function `main':
hello3.c:(.text+0x0): multiple definition of `main'
hello.o:hello.c:(.text+0x0): first defined here
collect2: ld 返回 1
make: *** [appexam] 错误 1
zhao@zhao-VirtualBox:~/workspace$