0

I am resently asked to use my keras model (trained in python) in c++ application with gpu-acceration.
But I am really a complete novice about c++ and msvc.
I tried to build tensorflow c++ library in this issue.
I set bazel-bin\tensorflow\include\ to include path of my project. Then I tried this very small tensorflow c++ program here.

#include <stdio.h>
#include <tensorflow/c/c_api.h>

int main() {
    printf("Hello from TensorFlow C library version %s\n", TF_Version());
    return 0;
}

But I got an error like this:

Build started...
1>------ Build started: Project: TF_savedmodel, Configuration: Release x64 ------
1>Source.cpp
1>D:\python\tensorflow\bazel-bin\tensorflow\include\tensorflow\c\c_api.h(953,68): warning C4190: 'TF_NewWhile' has C-linkage specified, but returns UDT 'TF_WhileParams' which is incompatible with C
1>D:\python\tensorflow\bazel-bin\tensorflow\include\tensorflow\c\c_api.h(909): message : see declaration of 'TF_WhileParams'
1>Source.obj : error LNK2001: unresolved external symbol __imp_TF_Version
1>D:\tf_model\TF_savedmodel\x64\Release\TF_savedmodel.exe : fatal error LNK1120: 1 unresolved externals
1>Done building project "TF_savedmodel.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I am now really upset about tensorflow c++.
I have tried tensorflow c++ for two weeks but haven't made a small program worked.
I will truly appreciate it if someone can help.

0 Answers0