简体   繁体   English

C程序,链接器错误

[英]C Program, linker error

#include <stdio.h>

int main(int argc, char *argv[]) 
{
   print("Merry Christmas and happy holidays!");
   return 0;
}

Can someone please run this on your system and check back why? 有人可以在您的系统上运行此命令,然后查看原因吗?

It says, linker error print is not defined . 它说, print is not defined linker error print is not defined

标准C中没有print功能。您要查找的功能是printff格式化的缩写。

printf("Merry Christmas and happy holidays!");

It is not print , it is called printf function. 它不是print ,它称为printf函数。 There is nothing call print in C .standard 在C .standard中没有任何调用print

linker errors are due to the call of functions that are not defined or due to wrong way of call of a function. 链接器错误是由于未定义函数的调用或函数的错误调用方式引起的。

In your program function print() does not exist anywhere as a user defined function nor does it exist in the header 'stdio.h' that you included. 在您的程序函数中, print()作为用户定义的函数不存在,也不在您包含的标头'stdio.h'中。

To print a line in C you need to use printf() statement and not print() as in your program. 要打印使用C,你需要使用一个线printf()语句,而不是print()在你的程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM