隐式函数声明

问题描述 投票:0回答:1

所以我只是在 VS code(c 语言)中运行基本的 hello world 代码

然后我去终端写了“

gcc .\ first project c
”(第一个项目是文件名)

然后我得到了这个

PS C:\Users\user\Documents\VS CODES> gcc '.\first project.c'
.\first project.c: In function 'main':
.\first project.c:4:5: warning: implicit declaration of function 'print' [-Wimplicit-function-declaration]
     print("Hello World");
     ^~~~~
C:\Users\user\AppData\Local\Temp\ccGIZDx0.o:first project.c:(.text+0x16): undefined reference to `print
collect2.exe: error: ld returned 1 exit status

有一个与此类似的问题,但答案是hoshposh,我什么也得不到

ik这个问题可能很愚蠢,但我只是初学者所以..

感谢您的帮助

运行 hello world 代码

`#include<stdio.h>

int main(){
    print("Hello World");
    return 0;   
}
`

然后进入编译器并尝试使用 gcc 运行,但上述代码出现在终端中...... 我在堆栈溢出上搜索了它并得到了问题,但答案都很混乱

请用通俗的语言给我解释一下

c gcc g++ implicit
1个回答
0
投票

看起来您正在使用

print("Hello World");
而不是
printf("Hello World");

© www.soinside.com 2019 - 2024. All rights reserved.