小编ups*_*sdn的帖子

C错误:未定义的函数引用,但它已定义

只是一个简单的程序,但我一直得到这个编译错误.我正在使用MinGW作为编译器.

这是头文件,point.h:

//type for a Cartesian point
typedef struct {
  double x;
  double y;
} Point;

Point create(double x, double y);
Point midpoint(Point p, Point q);
Run Code Online (Sandbox Code Playgroud)

这是重点.:

//This is the implementation of the point type
#include "point.h"

int main() {
  return 0;
}
Point create(double x, double y) {
  Point p;
  p.x = x;
  p.y = y;
  return p;
}

Point midpoint(Point p, Point q) {
  Point mid;
  mid.x = (p.x + q.x) / 2;
  mid.y …
Run Code Online (Sandbox Code Playgroud)

c function linker-errors undefined-reference

55
推荐指数
3
解决办法
30万
查看次数

标签 统计

c ×1

function ×1

linker-errors ×1

undefined-reference ×1