Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Solved QtPluginLoader fails to load plugin if I use Tensorflow functions in it

    General and Desktop
    plugins plugin windows load
    3
    4
    568
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      fugreh last edited by fugreh

      I am making a plugin as a project in Visual Studio 2017 which loads a Tensorflow model and uses it in an application. The plugin includes a class which loads a Tensorflow model and links with Tensorflow 1.7 (built for Release, I also build the plugin for Release). If I comment out all of the functions and structures from the Tensorflow library (e.g., tensorflow::GraphDef, etc.) then the plugin loads. If I uncomment them it fails to load:

      QPluginLoader *loader = new QPluginLoader(pluginsDir.absoluteFilePath(pluginPath));
      QObject *plugin = loader->instance(); // plugin is NULL
      

      plugin->errorString() is

      "CNNPlugin.dll" "Cannot load library ...\\bin\\Release\\plugins\\CNNPlugin.dll: The specified module could not be found."
      

      But it is there, and it loads just fine if I comment out all Tensorflow related code as mentioned. I tried linking with and running tensorflow in a simple C++ console application and that worked without issue.

      JKSH 1 Reply Last reply Reply Quote 0
      • Christian Ehrlicher
        Christian Ehrlicher Lifetime Qt Champion last edited by

        Make sure the TensorFlow library is in your Path when trying to load the library.

        Qt has to stay free or it will die.

        1 Reply Last reply Reply Quote 4
        • JKSH
          JKSH Moderators @fugreh last edited by

          @fugreh said in QtPluginLoader fails to load plugin if I use Tensorflow functions in it:

          But it is there, and it loads just fine if I comment out all Tensorflow related code as mentioned.

          To clarify @Christian-Ehrlicher's comment: Qt can't load your plugin if it can't find the TensorFlow libraries

          I tried linking with and running tensorflow in a simple C++ console application

          In this test, how did you tell Qt where to find the TensorFlow libraries?

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply Reply Quote 3
          • F
            fugreh last edited by

            Thanks for your input, the problem was that the DLL was actually not in the place where it should have been, my mistake.

            1 Reply Last reply Reply Quote 1
            • First post
              Last post