Search code examples
c++cntk

Evaluation with CNTKlibrary.h in C++ Project


I have trained my model with BrainScript and now want to use it in a C++ project. From the EvalMultithreads.cpp I copied all the relevant functions. I linked the CNTK.Core and CNTK.Math library and set their search path as described here. Of course I included the CNTKLibrary.h. When I build the project the compiler gives me this error:

undefined reference to `CNTK::Variable::Name[abi:cxx11]() const'

It referrers to this line :

if (it->Name().compare(varName) == 0)

of the EvalMultithreads.cpp function bool GetVariableByName, and also :

undefined reference to `CNTK::Function::LoadModel(std::__cxx11::basic_string CMakeFiles/xxx.dir/build.make:1848: recipe for target '/home/path/xxx.exe' failed CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/xxx.dir/all' failed Makefile:83: recipe for target 'all' failed

Does anyone had the same troubles?

FYI: I'm using Ubuntu 16.04, gcc version 5.4.0, CNTK ver2.0rc2 GPU with 1-bit SGD


Solution

  • The CNTK.Core and other libraries in the binary release package are compiled with GCC 4.8, so they cannot be directly linked with application using gcc 5.4.0. Please use the same build flavor (Debug/Release) and the same compiler version as the one used to create the libraries, as described here. If you want to use gcc 5.4.0, you need to build the library from source.