
C++ 编译问题: LNK2019:无法解析的外部符号 20
小白一只,正在自学,使用的是VS2013在试运行的时候出现如下错误:errorLNK2019:无法解析的外部符号"int__cdeclcoordinatejudge(do...
小白一只,正在自学,使用的是VS2013
在试运行的时候出现如下错误:
error LNK2019: 无法解析的外部符号 "int __cdecl coordinatejudge(double)" (?coordinatejudge@@YAHN@Z),该符号在函数 _wmain 中被引用 E:\Data\VS2013 Project\homework\Page113_12.c\Page113_12.c\Page113_12.c.obj Page113_12.c
= =望各位指教
以下是源代码:
// Page113_12.c.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "math.h"
/*函数声明*/
int rangepoint();
int enterpoint();
int coordinatejudge(double A);
int pointjudge(double B);
int rangejudge(double C, double D);
int output();
/*变量声明*/
double X, Y;
double X1, X2, Y1, Y2;
double A, B, C, D, R;
int _tmain(int argc, _TCHAR* argv[])
{
rangepoint();
enterpoint();
coordinatejudge(A);
pointjudge(B);
rangejudge(C,D);
output();
system("pause");
}
int rangepoint()
{
X1 = 2;
X2 = -2;
Y1 = 2;
Y2 = -2;
return 0;
}
int enterpoint()
{
printf("Please enter the X coordinate of point\n");
scanf_s("%d", &X);
printf("Please enter the Y coordinate of point\n");
scanf_s("%d", &Y);
return 0;
}
int coordinatejudge(int A)
{
if (X == 0)
{
A = 0;
}
else
{
if (Y == 0)
{
A = 0;
}
else
{
A = 1;
}
}
return A;
}
int pointjudge(int B)
{
if (A == 0)
{
B = 0;
}
else
{
if (X > 0)
{
if (Y > 0) //第一象限判断
{
C = X1;
D = Y1;
}
else //第四象限判断
{
C = X1;
D = Y2;
}
}
else
{
if (Y > 0) //第二象限判断
{
C = X2;
D = Y1;
}
else //第三象限判断
{
C = X2;
D = Y2;
}
}
rangejudge(C, D);
}
return B;
}
int rangejudge(int C, int D)
{
if (R * R <= (X - C)*(X - C) + (Y - D)*(Y - D))
{
B = 1;
}
else
{
B = 0;
}
return 0;
}
int output()
{
if (B == 0)
{
printf("The height of point is 0 m\n");
}
else
{
printf("The height of point is 10 m\n");
}
return 0;
} 展开
在试运行的时候出现如下错误:
error LNK2019: 无法解析的外部符号 "int __cdecl coordinatejudge(double)" (?coordinatejudge@@YAHN@Z),该符号在函数 _wmain 中被引用 E:\Data\VS2013 Project\homework\Page113_12.c\Page113_12.c\Page113_12.c.obj Page113_12.c
= =望各位指教
以下是源代码:
// Page113_12.c.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include "math.h"
/*函数声明*/
int rangepoint();
int enterpoint();
int coordinatejudge(double A);
int pointjudge(double B);
int rangejudge(double C, double D);
int output();
/*变量声明*/
double X, Y;
double X1, X2, Y1, Y2;
double A, B, C, D, R;
int _tmain(int argc, _TCHAR* argv[])
{
rangepoint();
enterpoint();
coordinatejudge(A);
pointjudge(B);
rangejudge(C,D);
output();
system("pause");
}
int rangepoint()
{
X1 = 2;
X2 = -2;
Y1 = 2;
Y2 = -2;
return 0;
}
int enterpoint()
{
printf("Please enter the X coordinate of point\n");
scanf_s("%d", &X);
printf("Please enter the Y coordinate of point\n");
scanf_s("%d", &Y);
return 0;
}
int coordinatejudge(int A)
{
if (X == 0)
{
A = 0;
}
else
{
if (Y == 0)
{
A = 0;
}
else
{
A = 1;
}
}
return A;
}
int pointjudge(int B)
{
if (A == 0)
{
B = 0;
}
else
{
if (X > 0)
{
if (Y > 0) //第一象限判断
{
C = X1;
D = Y1;
}
else //第四象限判断
{
C = X1;
D = Y2;
}
}
else
{
if (Y > 0) //第二象限判断
{
C = X2;
D = Y1;
}
else //第三象限判断
{
C = X2;
D = Y2;
}
}
rangejudge(C, D);
}
return B;
}
int rangejudge(int C, int D)
{
if (R * R <= (X - C)*(X - C) + (Y - D)*(Y - D))
{
B = 1;
}
else
{
B = 0;
}
return 0;
}
int output()
{
if (B == 0)
{
printf("The height of point is 0 m\n");
}
else
{
printf("The height of point is 10 m\n");
}
return 0;
} 展开
1个回答
展开全部
int coordinatejudge(double A);
int coordinatejudge(int A)
这是两个不同的函数,前者(“coordinatejudge(double) ”)没有定义
追问
= =多谢指教
还有……Debug了之后可以运行了,但不管我输入的坐标数为多少,最后显示的都是0m是什么情况呢?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询