'Problems when installing cppflow

I am trying to use the c++ wrapper for tensorflow api from https://github.com/serizba/cppflow.

I have copied the git repository. Downloaded the tensorflow api files (copied them into the cppflow folder), when I build the project in the folder, and then tries to run it from the project file created I get 37 errors, all related to Model.obj and Tensor.obj.

LNK2019 unresolved external symbol __imp_TF_NewStatus referenced in function "public: __cdecl Model::Model(class std::basic_string,class std::allocator > const &)" (??0Model@@QEAA@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) example *\cppflow\examples\load_model\build\Model.obj 1

I am running it on Windows 10, with a c++ 17 compiler.

The CMakeFiles contain the following lines:

cmake_minimum_required(VERSION 3.10)
project(example)
set(CMAKE_CXX_STANDARD 17)
add_executable(example main.cpp ../../src/Model.cpp ../../src/Tensor.cpp)
target_include_directories(example PRIVATE ../../include)
target_link_libraries (example -ltensorflow)

I am trying to run a example from the github repo.

#include "../../include/Model.h"
#include "../../include/Tensor.h"
#include <numeric>
#include <iomanip>

int main() {
   Model model("../model.pb");
   model.init();

   auto input_a = new Tensor(model, "input_a");
   auto input_b = new Tensor(model, "input_b");
   auto output  = new Tensor(model, "result");

   std::vector<float> data(100);
   std::iota(data.begin(), data.end(), 0);

   input_a->set_data(data);
   input_b->set_data(data);

   model.run({input_a, input_b}, output);
   for (float f : output->get_data<float>()) {
       std::cout << f << " ";
   }
   std::cout << std::endl;

}

Does anybody have any suggestions?



Solution 1:[1]

"Downloaded the tensorflow api files (copied them into the cppflow folder), " Try downloading tensorflow_c_api into separate folder. No need to place inside cppflow directory.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 YScharf