Open monajalal opened 7 years ago
The code above looks like an old version, it's using several old APIs, hence the deprecated warnings, however these older APIs should still be supported, so I'm not sure why you are getting the vector float error.
You can find an updated version of this example here:
https://github.com/nickgillian/grt#getting-started-example
Can you point me to where you found this older example so I can update it.
Thanks!
Hey @nickgillian the example you link to above contains an error, testAccuracy
is undefined.
But in any case, I can also reproduce the unresolved external symbol issue. Steps to reproduce:
The following errors are generated:
Severity Code Description Project File Line Suppression State
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __thiscall GRT::VectorFloat::VectorFloat(class GRT::VectorFloat const &)" (__imp_??0VectorFloat@GRT@@QAE@ABV01@@Z) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: virtual __thiscall GRT::VectorFloat::~VectorFloat(void)" (__imp_??1VectorFloat@GRT@@UAE@XZ) referenced in function "public: __thiscall GRT::GaussNeuron::~GaussNeuron(void)" (??1GaussNeuron@GRT@@QAE@XZ) ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: double * __thiscall GRT::Matrix<double>::operator[](unsigned int)" (__imp_??A?$Matrix@N@GRT@@QAEPANI@Z) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall GRT::Matrix<double>::getNumRows(void)const " (__imp_?getNumRows@?$Matrix@N@GRT@@QBEIXZ) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall GRT::Matrix<double>::getNumCols(void)const " (__imp_?getNumCols@?$Matrix@N@GRT@@QBEIXZ) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: virtual __thiscall GRT::MatrixFloat::~MatrixFloat(void)" (__imp_??1MatrixFloat@GRT@@UAE@XZ) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall GRT::ClassificationSample::getClassLabel(void)const " (__imp_?getClassLabel@ClassificationSample@GRT@@QBEIXZ) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: class GRT::VectorFloat & __thiscall GRT::ClassificationSample::getSample(void)" (__imp_?getSample@ClassificationSample@GRT@@QAEAAVVectorFloat@2@XZ) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __thiscall GRT::ClassificationData::ClassificationData(unsigned int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (__imp_??0ClassificationData@GRT@@QAE@IV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0@Z) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __thiscall GRT::ClassificationData::ClassificationData(class GRT::ClassificationData const &)" (__imp_??0ClassificationData@GRT@@QAE@ABV01@@Z) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: virtual __thiscall GRT::ClassificationData::~ClassificationData(void)" (__imp_??1ClassificationData@GRT@@UAE@XZ) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: class GRT::ClassificationSample & __thiscall GRT::ClassificationData::operator[](unsigned int const &)" (__imp_??AClassificationData@GRT@@QAEAAVClassificationSample@1@ABI@Z) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: bool __thiscall GRT::ClassificationData::load(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?load@ClassificationData@GRT@@QAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: bool __thiscall GRT::ClassificationData::printStats(void)const " (__imp_?printStats@ClassificationData@GRT@@QBE_NXZ) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: class GRT::ClassificationData __thiscall GRT::ClassificationData::split(unsigned int,bool)" (__imp_?split@ClassificationData@GRT@@QAE?AV12@I_N@Z) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall GRT::ClassificationData::getNumSamples(void)const " (__imp_?getNumSamples@ClassificationData@GRT@@QBEIXZ) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __thiscall GRT::GestureRecognitionPipeline::GestureRecognitionPipeline(void)" (__imp_??0GestureRecognitionPipeline@GRT@@QAE@XZ) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: virtual __thiscall GRT::GestureRecognitionPipeline::~GestureRecognitionPipeline(void)" (__imp_??1GestureRecognitionPipeline@GRT@@UAE@XZ) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: class GRT::GestureRecognitionPipeline & __thiscall GRT::GestureRecognitionPipeline::operator<<(class GRT::Classifier const &)" (__imp_??6GestureRecognitionPipeline@GRT@@QAEAAV01@ABVClassifier@1@@Z) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: virtual bool __thiscall GRT::GestureRecognitionPipeline::test(class GRT::ClassificationData const &)" (__imp_?test@GestureRecognitionPipeline@GRT@@UAE_NABVClassificationData@2@@Z) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: virtual bool __thiscall GRT::GestureRecognitionPipeline::save(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (__imp_?save@GestureRecognitionPipeline@GRT@@UBE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: virtual bool __thiscall GRT::GestureRecognitionPipeline::load(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?load@GestureRecognitionPipeline@GRT@@UAE_NABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall GRT::GestureRecognitionPipeline::getNumClassesInModel(void)const " (__imp_?getNumClassesInModel@GestureRecognitionPipeline@GRT@@QBEIXZ) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: unsigned int __thiscall GRT::GestureRecognitionPipeline::getPredictedClassLabel(void)const " (__imp_?getPredictedClassLabel@GestureRecognitionPipeline@GRT@@QBEIXZ) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: double __thiscall GRT::GestureRecognitionPipeline::getTestAccuracy(void)const " (__imp_?getTestAccuracy@GestureRecognitionPipeline@GRT@@QBENXZ) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: double __thiscall GRT::GestureRecognitionPipeline::getTestFMeasure(unsigned int)const " (__imp_?getTestFMeasure@GestureRecognitionPipeline@GRT@@QBENI@Z) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: double __thiscall GRT::GestureRecognitionPipeline::getTestPrecision(unsigned int)const " (__imp_?getTestPrecision@GestureRecognitionPipeline@GRT@@QBENI@Z) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: double __thiscall GRT::GestureRecognitionPipeline::getTestRecall(unsigned int)const " (__imp_?getTestRecall@GestureRecognitionPipeline@GRT@@QBENI@Z) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: class GRT::MatrixFloat __thiscall GRT::GestureRecognitionPipeline::getTestConfusionMatrix(void)const " (__imp_?getTestConfusionMatrix@GestureRecognitionPipeline@GRT@@QBE?AVMatrixFloat@2@XZ) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: class GRT::Vector<unsigned int> __thiscall GRT::GestureRecognitionPipeline::getClassLabels(void)const " (__imp_?getClassLabels@GestureRecognitionPipeline@GRT@@QBE?AV?$Vector@I@2@XZ) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: __thiscall GRT::ANBC::ANBC(bool,bool,double)" (__imp_??0ANBC@GRT@@QAE@_N0N@Z) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK2019 unresolved external symbol "__declspec(dllimport) public: virtual __thiscall GRT::ANBC::~ANBC(void)" (__imp_??1ANBC@GRT@@UAE@XZ) referenced in function _main ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\ConsoleApplication1.obj 1
Error LNK1120 32 unresolved externals ConsoleApplication1 C:\Users\Jamie Bullock\Documents\ml-lib\build\win32\ConsoleApplication1\Debug\ConsoleApplication1.exe 1
This issue only applies to static linkage. Linking dynamically to grt seems to work fine.
OK, I think I've figured out what's going on here.
For building a static lib, or directly including the GRT sources in a project GRT_STATIC_LIB
needs to be defined so that GRT_API is not defined for dll exports. See:
#if !defined(GRT_STATIC_LIB) && defined(_MSC_VER)
#undef GRT_API
#ifdef GRT_DLL_EXPORTS
#define GRT_API __declspec(dllexport)
#else // GRT_DLL_EXPORTS
#define GRT_API __declspec(dllimport)
#endif // GRT_DLL_EXPORTS
//disable warnings about a "dllexport" class using a regular class
# pragma warning(disable: 4251)
#endif // !GRT_STATIC_LIB && MSC_VER
The above problem occurs when GRT_STATIC_LIB
is defined for GRT itself, but not for client code that consumes GRT.
The solution is to make sure GRT_STATIC_LIB
is defined in the client code preprocessor if it is also defined for the GRT build being used.
@jamiebullock Can you elaborate on what you did to get the static build working? I'm trying to do the same but can't figure out exactly where in the out-of-the-box build process to make changes.
@morphogencc Sorry for the disturbance, but were you able to get the build working? I am facing the same problem.
Unfortunately I haven't gotten it working, though I haven't tried since last year...
@MPillai1 what platform(s) are you on?
I am using Visual Studio 2019 on Windows 10.
After I received lots of deprecated method errors for save and load which I followed the error suggestions and they got resolved as well as one for
I get this new error. Am I using it wrong? Or what's wrong in general? I did a
git clone
of the repoand then am pointing to GRT folder in my ml101.cpp file as in below.
I found this code sample online. Please point out what's the fix.