读书人

error: expected ‘=’, ‘,’, ‘;’

发布时间: 2012-10-16 09:57:37 作者: rapoo

error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token
hello.c code:
#include<stdio.h>
void main
{
printf("hello work!");
}

compile:$ cc helloWork.c
helloWork.c:3: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘{’ token


why??


[解决办法]
我晕 main 后面没有括号啊
[解决办法]
main的括号呢?
[解决办法]
int man(void)
[解决办法]

C/C++ code
#include <stdio.h>int main(int argc, char *argv[]){  printf("Hello World ...\n");  return 0;}
[解决办法]
再精简也写个"main()"吧,不要连括号都省。

读书人网 >UNIXLINUX

热点推荐