【发布时间】:2021-01-29 01:15:05
【问题描述】:
#include <cs50.h>
#include <stdio.h>
bool maths (int a, int b, int c)
{
int first = a + b;
int second = b + c;
int third = c + a;
if (first <= c)
{
return false;
}
else if (second <= a)
{
return false;
}
else if (third <= b)
{
return false;
}
else
{
return true;
}
}
我在尝试编译时收到错误消息undefined reference to `main'。我试图查找此错误消息,但我发现的东西超出了我的想象。谁能向像我这样的新手解释我做错了什么?
$ clang -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow triangle.c -lcrypt -lcs50 -lm -o triangle
/usr/bin/ld: /usr/bin/../lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/crt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
clang-10: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [<builtin>: triangle] Error 1
【问题讨论】: