相关疑难解决方法(0)

没有标题的C程序

我在C写"hello world"程序.

void main()
{ printf("Hello World"); }
// note that I haven't included any header file
Run Code Online (Sandbox Code Playgroud)

该程序编译时带有警告

vikram@vikram-Studio-XPS-1645:~$ gcc hello.c 
hello.c: In function ‘main’:
hello.c:2:2: warning: incompatible implicit declaration of built-in function ‘printf’
vikram@vikram-Studio-XPS-1645:~$ ./a.out 
Hello Worldvikram@vikram-Studio-XPS-1645:~$
Run Code Online (Sandbox Code Playgroud)

这怎么可能?操作系统如何在不包含任何标题的情况下链接库?

c linux compilation dynamic-linking

3
推荐指数
2
解决办法
1668
查看次数

标签 统计

c ×1

compilation ×1

dynamic-linking ×1

linux ×1