注册 登录
编程论坛 C语言论坛

点build时,。显示出了一个错,不明白求解释

zhangss 发布于 2019-11-08 23:08, 1957 次点击
#include <stdio.h>
#include <math.h>

void main()
{
    double x,s;

    printf("input number:\n");
    scanf("%lf",&x);
    s = sin(x);
    printf("sin of %lf is %lf\n",x,s);
}               
  错误提示-----------------Configuration: cyuyan - Win32 Debug--------------------
Linking...
C语言格式.obj : error LNK2005: _main already defined in C语言。c.obj
Debug/cyuyan.exe : fatal error LNK1169: one or more multiply defined symbols found
执行 link.exe 时出错.

cyuyan.exe - 1 error(s), 0 warning(s)
3 回复
#2
forever742019-11-08 23:18
你把不相关的文件塞进了同一个工程,使得工程里面主函数超过了一个。
#3
zhangss2019-11-08 23:41
回复 2楼 forever74
你好,谢谢你帮我解答。我新手所以有很多不懂。,还有个问题求您帮忙解决一下。
一个工程不能有多个主函数,那为什么还可以建多个文件,这是干什么的呢?
#4
forever742019-11-09 06:14
其他文件都是辅助,不必带有主函数。
1