【发布时间】:2015-03-21 03:38:41
【问题描述】:
当我编译像“hello world”这样的简单程序时,我在printf 函数处收到警告。
这是错误消息:
hey.c:4:5: warning: implicit declaration of function 'puts' is invalid in C99
[-Wimplicit-function-declaration]
puts("Hello World!");
^
1 warning generated.
ld: can't write output file: a.out for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
【问题讨论】:
-
谷歌搜索警告会给你所有你想要的
-
@ArjunSreedharan 这正是我看到问题时所做的
-
您是在源代码中写了
printf(),还是写了puts()并在写问题时打错了字(您提到printf())。由于消息显示puts(),我宁愿认为你写了puts(),但clang足够聪明,可以将printf("Hello World!\n");之类的调用替换为puts("Hello World!");(GCC 也是如此),所以它可能是。