PGC-W-0156-Type not specified, 'int' assumed (fun.c: 2)

I used a very simple hello.c program as listed below and tried compiling with pgcc.

#include <stdio.h>
main() {
printf(“Hello World!\n”);

It gave the following warning:
PGC-W-0156-Type not specified, ‘int’ assumed (hello.c: 2)
PGC/x86-64 Linux/x86-64 6.2-4: compilation completed with warnings

The PGI version I’m using is:
pgcc 6.2-4 64-bit target on x86-64 Linux
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2006, STMicroelectronics, Inc. All Rights Reserved.

Is there any clue? Thanks.


Yes. You did not specify a return type for the main function. In ISO C when no return type is specified, int is assumed. To be clear you should define main to be:

int main(void)

Where the proper header files (stdlib.h) are included.