|
发表于 2022-11-15 22:30:54
|
显示全部楼层
本楼为最佳答案
本帖最后由 jackz007 于 2022-11-15 22:32 编辑
确实,VC都可以,但是 gcc 不灵
【tdm-gcc 5.1.0】:
- D:\[00.Exerciese.2022]\C>g++ -o x x.c
- x.c:3:11: error: '::main' must return 'int'
- void main()
- ^
- x.c: In function 'int test()':
- x.c:15:18: error: 'max' was not declared in this scope
- c=max(a,b);
- ^
- D:\[00.Exerciese.2022]\C>
复制代码
【vc6.0】:
- D:\[00.Exerciese.2022]\C>cl x.c
- Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8804 for 80x86
- Copyright (C) Microsoft Corp 1984-1998. All rights reserved.
- x.c
- Microsoft (R) Incremental Linker Version 6.00.8447
- Copyright (C) Microsoft Corp 1992-1998. All rights reserved.
- /out:x.exe
- x.obj
- D:\[00.Exerciese.2022]\C>
复制代码
【vc9.0】:
- D:\[00.Exerciese.2022]\C>cl x.c
- 用于 80x86 的 Microsoft (R) 32 位 C/C++ 优化编译器 15.00.30729.01 版
- 版权所有(C) Microsoft Corporation。保留所有权利。
- x.c
- Microsoft (R) Incremental Linker Version 9.00.30729.01
- Copyright (C) Microsoft Corporation. All rights reserved.
- /out:x.exe
- x.obj
- D:\[00.Exerciese.2022]\C>
复制代码 |
|