Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Galil and Qt on Windows 7
Forum Updated to NodeBB v4.3 + New Features

Galil and Qt on Windows 7

Scheduled Pinned Locked Moved Solved 3rd Party Software
9 Posts 2 Posters 3.5k Views 2 Watching
  • 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.
  • T Offline
    T Offline
    Tobster
    wrote on last edited by
    #1

    Hi there,

    I am trying to create a simple application to connect to a Galil controller and followed their install instructions (http://www.galilmc.com/sw/pub/all/doc/gclib/html/windows.html).

    However, it appears that it cannot find the functions provided by the library (e.g. GClose() used below in the cpp code). The error message is "undefined reference to `GClose@4' ."

    Is there an issue with my .pro file (shown below)?

    Thank you!!

    Details:

    I started using the serial port terminal example from Qt and added the following .h file:

    #ifndef GRIFFIN_H
    #define GRIFFIN_H

    #include "gclib.h"
    #include "gclibo.h"
    #include "gclib_errors.h"
    #include "gclib_record.h"

    class Griffin
    {

    private:
    GCon *m_g;
    GCStringIn m_IP_ADDR = "10.63.32.65";
    int m_SPEED = 20;

    public:
    Griffin();
    ~Griffin();
    int connect();
    };

    #endif // GRIFFIN_H

    The corresponding .cpp file is:

    #include "griffin.h"
    #include <iomanip>
    #include <iostream>

    Griffin::Griffin()
    {
    m_g = new GCon;
    }

    Griffin::~Griffin()
    {
    GClose(m_g);
    delete m_g;
    }

    int Griffin::connect()
    {
    //GCStringIn openParams(" -d -t 10000");
    //std::cout << openParams << std::endl;
    //GOpen();
    return(0);
    }

    I copied to .dll .lib and .h files to a local directory and edited the .pro file as follows:

    QT += widgets serialport

    TARGET = terminal
    TEMPLATE = app

    SOURCES +=
    main.cpp
    mainwindow.cpp
    settingsdialog.cpp
    console.cpp
    griffin.cpp

    HEADERS +=
    mainwindow.h
    settingsdialog.h
    console.h
    griffin.h

    FORMS +=
    mainwindow.ui
    settingsdialog.ui

    RESOURCES +=
    terminal.qrc

    target.path = $$[QT_INSTALL_EXAMPLES]/serialport/terminal
    INSTALLS += target

    LIBS += "C:/Magnetic_tracking/NDI/Code/terminal/GalilLibrary/gclib.lib"
    LIBS += "C:/Magnetic_tracking/NDI/Code/terminal/GalilLibrary/gclibo.lib"

    INCLUDEPATH += "C:/Magnetic_tracking/NDI/Code/terminal/GalilLibrary/"
    DEPENDPATH += "C:/Magnetic_tracking/NDI/Code/terminal/GalilLibrary/"
    QT += widgets serialport

    TARGET = terminal
    TEMPLATE = app

    SOURCES +=
    main.cpp
    mainwindow.cpp
    settingsdialog.cpp
    console.cpp
    griffin.cpp

    HEADERS +=
    mainwindow.h
    settingsdialog.h
    console.h
    griffin.h

    FORMS +=
    mainwindow.ui
    settingsdialog.ui

    RESOURCES +=
    terminal.qrc

    target.path = $$[QT_INSTALL_EXAMPLES]/serialport/terminal
    INSTALLS += target

    LIBS += "C:/Magnetic_tracking/NDI/Code/terminal/GalilLibrary/gclib.lib"
    LIBS += "C:/Magnetic_tracking/NDI/Code/terminal/GalilLibrary/gclibo.lib"

    INCLUDEPATH += "C:/Magnetic_tracking/NDI/Code/terminal/GalilLibrary/"
    DEPENDPATH += "C:/Magnetic_tracking/NDI/Code/terminal/GalilLibrary/"

    1 Reply Last reply
    0
    • T Offline
      T Offline
      Tobster
      wrote on last edited by
      #2

      To add:

      in gclib.h it says:

      //set library visibility for gcc and msvc
      #if BUILDING_GCLIB && HAVE_VISIBILITY
      #define GCLIB_DLL_EXPORTED attribute((visibility("default")))
      #elif BUILDING_GCLIB && defined _MSC_VER
      #define GCLIB_DLL_EXPORTED __declspec(dllexport)
      #elif defined _MSC_VER
      #define GCLIB_DLL_EXPORTED __declspec(dllimport)
      #else
      #define GCLIB_DLL_EXPORTED
      #endif

      and

      //! Closes a connection to a Galil Controller.
      GCLIB_DLL_EXPORTED GReturn GCALL GClose(GCon g);
      
      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        Which exact version of Qt are you using to build your application ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        T 1 Reply Last reply
        1
        • SGaistS SGaist

          Hi and welcome to devnet,

          Which exact version of Qt are you using to build your application ?

          T Offline
          T Offline
          Tobster
          wrote on last edited by
          #4

          @SGaist
          Hi, thank you!

          Qt Creator 4.0.2
          Based on Qt 5.7.0 (MSVC 2013, 32 bit)

          1 Reply Last reply
          1
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            That's the Qt Creator version, what Qt version are you using ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            T 2 Replies Last reply
            0
            • SGaistS SGaist

              That's the Qt Creator version, what Qt version are you using ?

              T Offline
              T Offline
              Tobster
              wrote on last edited by
              #6

              @SGaist
              It's 5.7.0
              From the build settings:
              Desktop Qt 5.7.0 MinGW 32bit

              1 Reply Last reply
              0
              • SGaistS SGaist

                That's the Qt Creator version, what Qt version are you using ?

                T Offline
                T Offline
                Tobster
                wrote on last edited by Tobster
                #7

                @SGaist
                DependencyWalker identified issues with a bunch of DLL dependencies (API-MS-WIN-CORE_WINRT- ...).

                This led me to this thread:

                https://stackoverflow.com/questions/17023419/win-7-64-bit-dll-problems

                This issue may not be related to Qt after all but rather be caused by a missing Visual studio "redistributable package."

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  With which compiler is your version of Galil compiled ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  T 1 Reply Last reply
                  0
                  • SGaistS SGaist

                    With which compiler is your version of Galil compiled ?

                    T Offline
                    T Offline
                    Tobster
                    wrote on last edited by
                    #9

                    @SGaist
                    I believe I found the issue:

                    Galil's installer placed the *.dll in a different path than the *.lib files:

                    ..\gclib\dll\x86

                    versus

                    ..\gclib\lib\dynamic\x86

                    When I copied the *.dll files to the same folder as the *.lib files, the problem went away.

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved