Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Language Bindings
  4. erreur : undefined reference to `viOpenDefaultRM@4'
Forum Updated to NodeBB v4.3 + New Features

erreur : undefined reference to `viOpenDefaultRM@4'

Scheduled Pinned Locked Moved Unsolved Language Bindings
12 Posts 2 Posters 1.9k Views
  • 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.
  • C Chaymoss

    Hello,
    I'm looking to use the right DLL package in order to define viOpenDefaultRM@4
    However, after including the path to the DLL folder in WD_V5-masterv2.pro as you can see the lines below, I get viOpenDefaultRM not defined.

    INCLUDEPATH = +='C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL'
    DEPENDPATH = +='C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL'
    

    Right below, the code that I'm trying to run in a .cpp file in order to detect a PXI address

    // Connect to PXI test
    
    #include "stdio.h"
    #include "IviVisaType.h"
    #include "visa.h"
    #include "visatype.h"
    #include "vpptype.h"
    //#include "stdafx.h"
    void discoverPXI()
    {
    ViSession rm = VI_NULL;
    viOpenDefaultRM( &rm );
    ViChar search[] = "PXI?*::INSTR";
    ViFindList find = VI_NULL;
    ViUInt32 count = 0;
    ViChar rsrc[256];
    ViStatus status = viFindRsrc( rm, search, &find, &count, rsrc );
    if( status==VI_SUCCESS && count>0 )
    {
    do
    {
    printf( "Found: \"%s\"\n", rsrc );
    status = viFindNext( find, rsrc );
    } while( status==VI_SUCCESS );
    viClose( find );
    }
    else if( count==0 )
    {
    printf( "No PXI instrument found\n" );
    }
    viClose( rm );
    //return 0;
    }
    

    Any suggestion will be appreciated.
    Thank you in advance

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by
    #2

    @Chaymoss said in erreur : undefined reference to `viOpenDefaultRM@4':

    INCLUDEPATH = +='C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL'
    DEPENDPATH = +='C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL'

    These lines do not look syntactically correct.
    I don't know if you need to add something to LIBS?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      Chaymoss
      wrote on last edited by
      #3

      Thank you JonB for your reply.

      I did use the following lines of code :

      LIBS = +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\NationalInstruments.Common.dll"
      LIBS = +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\niVISAsys.dll"
      

      However, I get this error :

      :-1: erreur : error: +=C:\Users\operateur\Documents\CB\WD_V5-masterv2\niVISAsys.dll: Invalid argument
      

      When I comment out the second line I get this :

      :-1: erreur : error: +=C:\Users\operateur\Documents\CB\WD_V5-masterv2\NationalInstruments.Common.dll: Invalid argument
      

      Can you tell me what's wrong with using the whole folder that contains all the DLLs?
      Thank you in advance.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Chaymoss
        wrote on last edited by
        #4

        Thank you, it's my first time coding with C/C++ in Qt Creator.
        After correcting the syntax:

        LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.Common.dll"
        LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\niVISAsys.dll"
        
        

        I get the following error :

        C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\niVISAsys.dll:-1: erreur : file not recognized: File format not recognized
        

        Does that mean that the file has been corrupted?
        Thank you in advance

        JonBJ 1 Reply Last reply
        0
        • C Chaymoss

          Thank you, it's my first time coding with C/C++ in Qt Creator.
          After correcting the syntax:

          LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.Common.dll"
          LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\niVISAsys.dll"
          
          

          I get the following error :

          C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\niVISAsys.dll:-1: erreur : file not recognized: File format not recognized
          

          Does that mean that the file has been corrupted?
          Thank you in advance

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by JonB
          #5

          @Chaymoss
          You do not link DLL files, rather the .LIB or .a file supplied with the DLL for those who want to link against it.

          BTW this is not a C/C++ or Creator issue.

          You need to be following some instructions from the package you are trying to use.

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Chaymoss
            wrote on last edited by
            #6

            Thank you JonB for your answer.

            aa56f871-6844-4183-9f3a-4479ce7ad41b-image.png

            Above, you can see the instructions that I should follow in order to use the driver.
            In WD_V5-masterv2.pro, I added these paths :

            INCLUDEPATH += 'C:/Program Files (x86)/IVI Foundation/IVI/Lib/msc'
            DEPENDPATH += 'C:/Program Files (x86)/IVI Foundation/IVI/Lib/msc'
            
            
            INCLUDEPATH += $$PWD/'fftw'
            DEPENDPATH += $$PWD/'fftw'
            
            INCLUDEPATH += 'C:/Program Files (x86)/IVI Foundation/IVI/Include'
            DEPENDPATH += 'C:/Program Files (x86)/IVI Foundation/IVI/Include'
            
            INCLUDEPATH += 'C:\Program Files (x86)\IVI Foundation\IVI\Lib_x64\msc'
            DEPENDPATH += 'C:\Program Files (x86)\IVI Foundation\IVI\Lib_x64\msc'
            

            And I added this .LIB file :

            LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\AqMD3.lib"
            

            However, I'm getting the same error :

            C:\Users\operateur\Documents\CB\WD_V5-masterv2\mainwindow.cpp:1034: erreur : undefined reference to `viOpenDefaultRM@4'
            debug/mainwindow.o: In function `Z11discoverPXIv':
            C:\Users\operateur\Documents\CB\WD_V5-masterv2/mainwindow.cpp:1034: undefined reference to `viOpenDefaultRM@4'
            

            Is there another step that I'm missing?
            Help please.
            Thank you

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Chaymoss
              wrote on last edited by
              #7

              I tried to add all the needed (I think?) .DLL files :

              LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.Common.dll"
              LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.VisaNS.dll"
              LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.ModularInstruments.NIDCPower.Fx45.dll"
              LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.DAQmx.dll"
              LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.ModularInstruments.NISwitch.Fx45.dll"
              LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.ModularInstruments.NIScope.Fx45.dll"
              LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\AqMD3.lib"
              

              And now, I'm getting this error :

              11:29:47: Starting C:\Users\operator\Documents\CB\WD_V5-masterv2\debug\WD_V4.exe...
              11:29:47: Failed to run program. Wrong path or permissions?
              11:29:47: C:\Users\operator\Documents\CB\WD_V5-masterv2\debug\WD_V4.exe exited with code -1
              

              Is there a specific permession or a configuration that I should do for Qt Creator?
              Thank you in advance.

              JonBJ 1 Reply Last reply
              0
              • C Chaymoss

                I tried to add all the needed (I think?) .DLL files :

                LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.Common.dll"
                LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.VisaNS.dll"
                LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.ModularInstruments.NIDCPower.Fx45.dll"
                LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.DAQmx.dll"
                LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.ModularInstruments.NISwitch.Fx45.dll"
                LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\DLL\NationalInstruments.ModularInstruments.NIScope.Fx45.dll"
                LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\AqMD3.lib"
                

                And now, I'm getting this error :

                11:29:47: Starting C:\Users\operator\Documents\CB\WD_V5-masterv2\debug\WD_V4.exe...
                11:29:47: Failed to run program. Wrong path or permissions?
                11:29:47: C:\Users\operator\Documents\CB\WD_V5-masterv2\debug\WD_V4.exe exited with code -1
                

                Is there a specific permession or a configuration that I should do for Qt Creator?
                Thank you in advance.

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by
                #8

                @Chaymoss
                I really don't know. I still don't think any .DLL files should be in your LIBS. I don't know if you aren't supposed to act on the "Prefix function calls with AqMD3_".

                The library looks like it is an MSVC one, like it tells you. But the error message looks like you are using MinGW compiler/linker for your Qt? You have not mentioned this? Do you not think that is relevant? You cannot mix MinGW and MSVC code/modules/libraries....

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  Chaymoss
                  wrote on last edited by
                  #9

                  Thank you JonB for your reply.
                  Yes, now I'm noticing the added compiler MSVC, which is automatically added by Qt, as you can see in the image down below :
                  0add8cbe-afcb-43fb-98bd-cea641ad0977-image.png
                  Should I delete MinGW or convert MSVC libraries to MinGW?
                  0bedc757-7cf5-4ee6-a69d-d53040beda0f-image.png
                  I can't see how to do that, should I remove all the traces of code that use MinGW in the project?
                  Thank you in advance.

                  JonBJ 1 Reply Last reply
                  0
                  • C Chaymoss

                    Thank you JonB for your reply.
                    Yes, now I'm noticing the added compiler MSVC, which is automatically added by Qt, as you can see in the image down below :
                    0add8cbe-afcb-43fb-98bd-cea641ad0977-image.png
                    Should I delete MinGW or convert MSVC libraries to MinGW?
                    0bedc757-7cf5-4ee6-a69d-d53040beda0f-image.png
                    I can't see how to do that, should I remove all the traces of code that use MinGW in the project?
                    Thank you in advance.

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by
                    #10

                    @Chaymoss said in erreur : undefined reference to `viOpenDefaultRM@4':

                    Should I delete MinGW or convert MSVC libraries to MinGW?

                    You should not "delete" anything, and you cannot "convert" libraries between MSVC & MinGW.

                    I am assuming you have some .lib file(s) given to you with this package? They are already compiled with MSVC for you to use, you are not compiling their source code to produce a library yourself, right?

                    Then you need to pick the kit you want Qt Creator to use. One of the MSVC and not MinGW ones. One "wrinkle" is I don't know whether the library you have requires MSVC 2015 or 2019. Obviously you must also match the correct 32- or 64-bitness.

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      Chaymoss
                      wrote on last edited by
                      #11

                      Thank you for your response.
                      I'm not looking to produce a library, I'm just trying to communicate with a PCIe, to use a PXI module for signal acquisition.
                      In order to achieve that, I think I should use a Driver provided by the manufacturer of the PCIe.
                      In this case the driver is AqMD3 IVI-C as you can see in the documentation
                      I added the .lib files in the project folder as you can see here :
                      9d2f70f1-c4dc-41b6-8bb7-ce04970c63b8-image.png
                      Adding them means that they will be compiled? The problem is I'm getting viOpenDefaultRM undefined beside other functions.
                      I'm adding all the libraries that I can find hoping to get one that works and define all the undefined functions (I'm not sure if this is the best strategy) that they are using in their provided code to detect the PXI module (I shared the code in my first post).
                      I chose MSVC 2015 64bit as a kit, because I don't have VS2015 so I guess it's there because their libraries are compiled with 2015 version. However, I recently installed the 2019 so maybe Qt detected that automatically and presented it in the Kits. Down below you can see the chosen kit:
                      55264040-a52b-4b7c-8e65-1694b0b43026-image.png

                      I also chose 64bit because I have 64 bit processor and I added their 64 bit libraries as follow :

                      LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\AqMD3.lib"
                      LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\AqLio.lib"
                      LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\IviConfigServer.lib"
                      LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\IviCShared.lib"
                      LIBS +="C:\Users\operateur\Documents\CB\WD_V5-masterv2\IviFloat.lib"
                      

                      You can also see what I have as compilers :
                      f41f9859-57b6-4d03-b406-6c0f055528bd-image.png

                      Not sure what I should use other than C/C++, I'm not finding MSVC 2015.
                      Now I'm just getting the error :

                      15:08:02: Starting C:\Users\operateur\Documents\CB\WD_V5-masterv2\debug\WD_V4.exe...
                      15:08:02: Failed to run program. Wrong path or permissions?
                      15:08:02: C:\Users\operator\Documents\CB\WD_V5-masterv2\debug\WD_V4.exe exited with code -1
                      

                      Any suggestion please?
                      Thank you in advance

                      1 Reply Last reply
                      0
                      • C Offline
                        C Offline
                        Chaymoss
                        wrote on last edited by
                        #12

                        In the compilation output the error is displayed as follow :

                        16:01:10: Start: "C:\Qt\Tools\mingw810_32\bin\mingw32-make.exe" -j8
                        C:/Qt/Tools/mingw810_32/bin/mingw32-make -f Makefile.Debug
                        mingw32-make[1]: Directory Entry 'C:/Users/operateur/Documents/CB/WD_V5-masterv2'
                        mingw32-make[1]: Nothing to do for 'first'.
                        mingw32-make[1]: Leaving the directory 'C:/Users/operateur/Documents/CB/WD_V5-masterv2'
                        
                        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