-2

Dear developers c++, I the next problem: trying to compile my project i'm getting the "error LNK2019: unresolved external symbol" even though all of the declared methods in headers are defined in the .cpp

I attach my code together with the post. Thank you for any assistance!

https://www.dropbox.com/s/e45oazbdc3b23tz/TSTGeometricLib.rar

p.s. the code is presented as VS2005 solution

the errors i get is next:

1>Wm5Vector3.obj : error LNK2019: unresolved external symbol "public: double const & __thiscall Wm5::Tuple::operatorconst " (??ATuple@Wm5@@QBEABNH@Z) referenced in function "public: __thiscall Wm5::Vector3::Vector3(class Wm5::Tuple const &)" (??0Vector3@Wm5@@QAE@ABVTuple@1@@Z)

1>Wm5Vector3.obj : error LNK2019: unresolved external symbol "public: double & __thiscall Wm5::Tuple::operator" (??ATuple@Wm5@@QAEAANH@Z) referenced in function "public: static void __cdecl Wm5::Vector3::ComputeExtremes(int,class Wm5::Vector3 const *,class Wm5::Vector3 &,class Wm5::Vector3 &)" (?ComputeExtremes@Vector3@Wm5@@SAXHPBV12@AAV12@1@Z)

1>Wm5Vector3.obj : error LNK2019: unresolved external symbol "class Wm5::Vector3 __cdecl Wm5::operator*(double,class Wm5::Vector3 const &)" (??DWm5@@YA?AVVector3@0@NABV10@@Z) referenced in function "public: static void __cdecl Wm5::Vector3::Orthonormalize(class Wm5::Vector3 &,class Wm5::Vector3 &,class Wm5::Vector3 &)" (?Orthonormalize@Vector3@Wm5@@SAXAAV12@00@Z)

  • You should consider adding the relevant part of the code to the question. And if you insist on putting an archive, make a zip please. – Theolodis May 27 '14 at 07:03

1 Answers1

0

To resolve the problems of the Wm5::Tuple::operator[] the solution is to put the functions in the header file. The linker does not like inline functions in a CPP.

And to resolve the problem of the Vector3 operator* (double scalar, const Vector3& vec); remove the inline from the header file and put the definition like:

inline Vector3 Wm5::operator* (double scalar, const Vector3& vec)

in the CPP file, since you also need to specify the namespace.

Ferenc Deak
  • 34,348
  • 17
  • 99
  • 167