gpt4 book ai didi

c++ - LNK2019 : unresolved external symbol - no template classes

转载 作者:太空宇宙 更新时间:2023-11-04 13:52:03 26 4
gpt4 key购买 nike

得到这个错误,看起来这些错误对于实例来说是相当独特的,而且所有的问题似乎都引用了模板,而这不是。

所以我得到的是:

Error 5 error LNK2019: unresolved external symbol "public: class Vec3 * __thiscall Patch::bezCurveInterp(class Curve,float)" (? bezCurveInterp@Patch@@QAEPAVVec3@@VCurve@@M@Z) referenced in function "public: class Vec3 * __thiscall Patch::bezPatchInterp(float,float)" (?bezPatchInterp@Patch@@QAEPAVVec3@@MM@Z) C:\Users\Sara\Documents\Sp14\184\Bezeir\Project1\Bezier.obj Project1

提到的函数在 bezier.cpp 中定义如下:

#include "Bezier.h"

Vec3* bezCurveInterp(Curve c, float u) {
Vec3* res = new Vec3[2];
return res;
}

在 bezier.h 我有(除其他外):

#ifndef BEZIER_H
#define BEZIER_H
#include "Primitives.h"

class Patch {
public:
Vec3* bezCurveInterp(Curve, float);

Vec3 在“Primitives.h”中定义:

#ifndef PRIMITIVES_H
#define PRIMITIVES_H

using namespace std;
// A class for representing Vec3s

class Vec3 {
public:
Vec3(); //among other things
};

在“Primitives.cpp”中:

#include "Primitives.h"

Vec3::Vec3() {
x = 0;
y = 0;
z = 0;
}

有什么突出的吗?感谢帮助 c++/visual studio 原来是一场噩梦............

最佳答案

你缺少来自 bezCurveInterp 的 Patch::

Vec3* Patch::bezCurveInterp(Curve c, float u)

关于c++ - LNK2019 : unresolved external symbol - no template classes,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23103012/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com