我正在一个名为TutorialsPoint的网站上学习C编程语言的基本概念.本网站上的源代码示例可以包含一个"试一试"按钮,该按钮可以使用在线c编译器(GNU GCC版本4.7.2)打开在线c编程环境.在一个示例中,演示了sizeof()函数.这是源代码.
#include <stdio.h>
#include <limits.h>
int main() {
printf("Storage size for int : %d \n", sizeof(int));
return 0;
}
Run Code Online (Sandbox Code Playgroud)
链接到课程:TutorialsPoint - C数据类型
在在线编程环境中编译和执行此程序时,将生成以下输出:
"Storage size for int : 4"
Run Code Online (Sandbox Code Playgroud)
当我尝试使用GNU GCC版本5.2.1在我的计算机上编译相同的代码时,收到以下错误消息:
gcc sizeofExample.c
sizeofExample.c: In function 'main':
sizeofExample.c:6:10: warning: format '%d' expects argument of type 'int',
but argument 2 has type 'long unsigned int' [-Wformat=]
printf("Storage size for int: %d \n", sizeof(int));
^
Run Code Online (Sandbox Code Playgroud)
这是我的源代码,只是为了彻底:
#include <stdio.h>
#include <limits.h>
int main()
{
printf("Storage size for int : %d \n", …Run Code Online (Sandbox Code Playgroud) 我已经在我的 Ubuntu 17.04 系统上安装了 GnuCOBOL 2.2。我已经编写了一个基本的 hello world 程序来测试编译器。
1 IDENTIFICATION DIVISION.
2 PROGRAM-ID. HELLO-WORLD.
3 *---------------------------
4 DATA DIVISION.
5 *---------------------------
6 PROCEDURE DIVISION.
7 DISPLAY 'Hello, world!'.
8 STOP RUN.
Run Code Online (Sandbox Code Playgroud)
该程序名为HelloWorld.cbl。当我用命令编译程序时
cobc HelloWorld.cbl
Run Code Online (Sandbox Code Playgroud)
HelloWorld.so 产生。当我尝试使用运行编译的程序时
cobcrun HelloWorld
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
libcob: entry point 'HelloWorld' not found
Run Code Online (Sandbox Code Playgroud)
任何人都可以向我解释 GnuCOBOL 中的入口点是什么,并可能提出一种解决问题并成功执行此 COBOL 程序的方法?