- 论坛徽章:
- 0
|
使用newt写了如下所示的一个简单的程序,编译出错,提示'NULL' undeclared 。但假如我把NULL用0替换,编译也会出错,提示
“undefined reference to `newtInit'”这样的信息。请教各位,该怎么写才不会出错呢?谢谢。
$ cat -n helloworld.c
1 #include<newt.h>
2
3 int main(int argc, char *argv[])
4 {
5 newtComponent form, button;
6 newtInit();
7 newtCls();
8 newtPushHelpLine("Press button to exit...");
9 newtOpenWindow(10, 5, 40, 6, "Button Sample");
10 button = newtButton(10, 1, "HelloWorld!");
11 form = newtForm(NULL, NULL, 0);
12 newtFormAddComponents(form, button, NULL);
13 newtRunForm(form);
14 newtFormDestroy(form);
15 newtFinished();
16 }
$ gcc -g helloworld.c -o helloworld
helloworld.c: In function 'main':
helloworld.c:11: error: 'NULL' undeclared (first use in this function)
helloworld.c:11: error: (Each undeclared identifier is reported only once
helloworld.c:11: error: for each function it appears in.)
$ |
|