Answer the question
In order to leave comments, you need to log in
How to fix LNK2019 error when using static method?
There is a set of various static functions ( link ).
I need a function in it
static CAAEllipticalObjectDetails Calculate(double JD, const CAAEllipticalObjectElements& elements, bool bHighPrecision);
CAAEllipticalObjectDetails ResTemp;
ResTemp = CAAElliptical::Calculate(JD, CAAObjectElem, bHighPrecision);
AA.obj : error LNK2019: unresolved external symbol "public: static class CAAEllipticalObjectDetails __cdecl CAAElliptical::Calculate(double,class CAAEllipticalObjectElements const &,bool)" ([email protected]@@[email protected]@[email protected]@[email protected]) referenced in function [email protected]
#include "aaplus\AA+.h"
Answer the question
In order to leave comments, you need to log in
There is no method implementation in the project. Add CPP/LIB.
Theoretically, it is not necessary to include the header file in the project, this is for your convenience (so that you do not lose the files that you have in the project). But cpp is necessary for anyone, because. otherwise, the compiler will not be asked to compile it, and the linker will not be told that there is an object file (which will be obtained after compilation) that contains implementations of certain functions. The result is that the linker searches and searches, and does not find the method release.
If you had lib instead of cpp, then the situation is the same, only without the compilation step. Roughly, you can think of a lib file as a group of object files put together. The already compiled code is in it, so it must be transferred immediately to the linker. To do this, the linker's keys specify the so-called Library Directories - directories where to look for libraries, as well as dependencies - which specific lib-files should be viewed when linking. The studio has both a global list of such directories and local settings for each project.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question