Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Library doesn't open
Forum Updated to NodeBB v4.3 + New Features

Library doesn't open

Scheduled Pinned Locked Moved General and Desktop
36 Posts 7 Posters 5.6k Views 3 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.
  • Pablo J. RoginaP Pablo J. Rogina

    @alexfi spolier alert: not tested! Could it be possible you need this? this is, telling the linker to use a library that doesn't follow the libNAME.so convention

    A Offline
    A Offline
    AlexFi
    wrote on last edited by
    #20

    @pablo-j-rogina

    I am not sure how to include this correct in my pro. file do you have an example or some explanations for this?

    g++ -o build/bin/myapp _mylib.so other_source_files
    

    Thank you for your help!!!

    @Christian-Ehrlicher
    I tried this also, but I get the undefined reference.

    Thank you also for your help!!!

    i also changed the library files from 64bit to 32bit because of that

    //qmake: qmake.exe ConnectBitScope.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
    
    Pablo J. RoginaP 1 Reply Last reply
    0
    • A AlexFi

      @pablo-j-rogina

      I am not sure how to include this correct in my pro. file do you have an example or some explanations for this?

      g++ -o build/bin/myapp _mylib.so other_source_files
      

      Thank you for your help!!!

      @Christian-Ehrlicher
      I tried this also, but I get the undefined reference.

      Thank you also for your help!!!

      i also changed the library files from 64bit to 32bit because of that

      //qmake: qmake.exe ConnectBitScope.pro -spec win32-g++ "CONFIG+=debug" "CONFIG+=qml_debug"
      
      Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #21

      @alexfi said in Library doesn't open:

      do you have an example or some explanations for this?

      have you checked the answers to that post? (hint: see #1...)

      Upvote the answer(s) that helped you solve the issue
      Use "Topic Tools" button to mark your post as Solved
      Add screenshots via postimage.org
      Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • A AlexFi

        @christian-ehrlicher
        I tried -lBitLib before, but there was the error lBitlib not found. After I changed the to -BitLib it was found. I thought that was linux syntax. Mabe you can help me to get this run.
        I installed the library in the C: folder after that I include this two lines in the pro file. i also added the header file in the project

        INCLUDEPATH +=C:/BitScope64/Library
        
        LIBS += -LC:/BitScope64/Library -lBitLib
        
        

        then i receive cannot find lBitLib

        the structure of the library folder is following:

        ->Library
           ->Document
           bitlib.def
           BitLib.dll
           bitlib.h
           BitLib.lib
           BitLib.pas
        
        -BitLib.dll
        -BitScope.prb
        -BitServe.prb
        
        
        aha_1980A Offline
        aha_1980A Offline
        aha_1980
        Lifetime Qt Champion
        wrote on last edited by
        #22

        @alexfi said in Library doesn't open:

        LIBS += -LC:/BitScope64/Library -lBitLib

        I have done that several times and it used to work with MinGW and MSVC too. Can you show the linker command line from Compile Output?

        Which MSVC version do you use?

        The reason to prefer the -L/path/to/lib -llibname syntax is that Creator recognizes this and adds /path/to/lib to your Run Environment so your program finds the DLL automatically.

        Qt has to stay free or it will die.

        1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher

          It's msvc, so according to the docs it must be

          LIBS += C:/BitScope64/Library/BitLib.lib

          aha_1980A Offline
          aha_1980A Offline
          aha_1980
          Lifetime Qt Champion
          wrote on last edited by
          #23

          @christian-ehrlicher I used that syntax before, but even MSVC can be feed with the Linux syntax (I guess qmake maps that), and that has advantages in Creator, see my last post.

          Qt has to stay free or it will die.

          A 1 Reply Last reply
          0
          • aha_1980A aha_1980

            @christian-ehrlicher I used that syntax before, but even MSVC can be feed with the Linux syntax (I guess qmake maps that), and that has advantages in Creator, see my last post.

            A Offline
            A Offline
            AlexFi
            wrote on last edited by
            #24

            @aha_1980
            I think this is the Compile Output you need:

            
            g++ -Wl,-subsystem,console -mthreads -o debug\ConnectBitScope.exe debug/main.o  -LC:\BitScope32\Library\BitLib.lib   
            debug/main.o: In function `main':
            C:\Users\adm-eep\Documents\ConnectBitScope\build-ConnectBitScope-Desktop_Qt_5_13_0_MinGW_64_bit-Debug/../ConnectBitScope/main.cpp:23: undefined reference to `BL_Open'
            collect2.exe: error: ld returned 1 exit status
            mingw32-make[1]: *** [Makefile.Debug:66: debug/ConnectBitScope.exe] Error 1
            mingw32-make: *** [Makefile:38: debug] Error 2
            mingw32-make[1]: Leaving directory 'C:/Users/adm-eep/Documents/ConnectBitScope/build-ConnectBitScope-Desktop_Qt_5_13_0_MinGW_64_bit-Debug'
            

            I use the MSVC 11.0

            @Pablo-J-Rogina

            I saw the example but i think this is for librarys with the ending .so I am no sure how to use this in my case

            aha_1980A Pablo J. RoginaP 2 Replies Last reply
            0
            • A AlexFi

              @aha_1980
              I think this is the Compile Output you need:

              
              g++ -Wl,-subsystem,console -mthreads -o debug\ConnectBitScope.exe debug/main.o  -LC:\BitScope32\Library\BitLib.lib   
              debug/main.o: In function `main':
              C:\Users\adm-eep\Documents\ConnectBitScope\build-ConnectBitScope-Desktop_Qt_5_13_0_MinGW_64_bit-Debug/../ConnectBitScope/main.cpp:23: undefined reference to `BL_Open'
              collect2.exe: error: ld returned 1 exit status
              mingw32-make[1]: *** [Makefile.Debug:66: debug/ConnectBitScope.exe] Error 1
              mingw32-make: *** [Makefile:38: debug] Error 2
              mingw32-make[1]: Leaving directory 'C:/Users/adm-eep/Documents/ConnectBitScope/build-ConnectBitScope-Desktop_Qt_5_13_0_MinGW_64_bit-Debug'
              

              I use the MSVC 11.0

              @Pablo-J-Rogina

              I saw the example but i think this is for librarys with the ending .so I am no sure how to use this in my case

              aha_1980A Offline
              aha_1980A Offline
              aha_1980
              Lifetime Qt Champion
              wrote on last edited by
              #25

              @alexfi said in Library doesn't open:

              I use the MSVC 11.0

              In that case, something is really weird set up - no wonder that it doesn't work.

              Your compile output clearly shows the MinGW linker running.

              Can you please show the screenshots of Tools > Options > Kits for Kits, Qt versions and compilers?

              Regards

              Qt has to stay free or it will die.

              A 1 Reply Last reply
              2
              • A AlexFi

                @aha_1980
                I think this is the Compile Output you need:

                
                g++ -Wl,-subsystem,console -mthreads -o debug\ConnectBitScope.exe debug/main.o  -LC:\BitScope32\Library\BitLib.lib   
                debug/main.o: In function `main':
                C:\Users\adm-eep\Documents\ConnectBitScope\build-ConnectBitScope-Desktop_Qt_5_13_0_MinGW_64_bit-Debug/../ConnectBitScope/main.cpp:23: undefined reference to `BL_Open'
                collect2.exe: error: ld returned 1 exit status
                mingw32-make[1]: *** [Makefile.Debug:66: debug/ConnectBitScope.exe] Error 1
                mingw32-make: *** [Makefile:38: debug] Error 2
                mingw32-make[1]: Leaving directory 'C:/Users/adm-eep/Documents/ConnectBitScope/build-ConnectBitScope-Desktop_Qt_5_13_0_MinGW_64_bit-Debug'
                

                I use the MSVC 11.0

                @Pablo-J-Rogina

                I saw the example but i think this is for librarys with the ending .so I am no sure how to use this in my case

                Pablo J. RoginaP Offline
                Pablo J. RoginaP Offline
                Pablo J. Rogina
                wrote on last edited by
                #26

                @alexfi said in Library doesn't open:

                librarys with the ending .so

                you may want to try with .lib in your case

                Upvote the answer(s) that helped you solve the issue
                Use "Topic Tools" button to mark your post as Solved
                Add screenshots via postimage.org
                Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                1 Reply Last reply
                0
                • aha_1980A aha_1980

                  @alexfi said in Library doesn't open:

                  I use the MSVC 11.0

                  In that case, something is really weird set up - no wonder that it doesn't work.

                  Your compile output clearly shows the MinGW linker running.

                  Can you please show the screenshots of Tools > Options > Kits for Kits, Qt versions and compilers?

                  Regards

                  A Offline
                  A Offline
                  AlexFi
                  wrote on last edited by
                  #27

                  @aha_1980 4_1568639741565_QT_version.JPG 3_1568639741565_Qbs.JPG 2_1568639741565_Kit.JPG 1_1568639741564_debugger.JPG 0_1568639741564_compiler.JPG

                  @Pablo-J-Rogina
                  I tried it like this :

                  g++ -o$$PWD/ $$PWD/BitLib.lib
                  
                  but i get the "extra characters after test expression" error
                  
                  
                  1 Reply Last reply
                  1
                  • Christian EhrlicherC Offline
                    Christian EhrlicherC Offline
                    Christian Ehrlicher
                    Lifetime Qt Champion
                    wrote on last edited by
                    #28

                    @manuja said in Library doesn't open:

                    LNK1104

                    This shows that you used the msvc linker before

                    BitLib.lib

                    This shows that the library was build with msvc
                    So if bitlib is a plain C library you can create a proper import lib with reimp & co (google is your friend) or you can try to link directly against the dll -> -lC:/BitScope64/Library/BitLib.dll - it should work with a recent MinGW version iirc.
                    If it's a c++ library than you have to recompile it with g++ to get a proper import lib (BitLib.a)

                    Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                    Visit the Qt Academy at https://academy.qt.io/catalog

                    A 1 Reply Last reply
                    1
                    • Christian EhrlicherC Christian Ehrlicher

                      @manuja said in Library doesn't open:

                      LNK1104

                      This shows that you used the msvc linker before

                      BitLib.lib

                      This shows that the library was build with msvc
                      So if bitlib is a plain C library you can create a proper import lib with reimp & co (google is your friend) or you can try to link directly against the dll -> -lC:/BitScope64/Library/BitLib.dll - it should work with a recent MinGW version iirc.
                      If it's a c++ library than you have to recompile it with g++ to get a proper import lib (BitLib.a)

                      A Offline
                      A Offline
                      AlexFi
                      wrote on last edited by
                      #29

                      @christian-ehrlicher
                      okay, if i under stand you right i have to reimport the lib, because it is written in c BitScope Librarys and this Bitscope example in C .

                      I tried this:

                      LIBS += -lC:/BitScope64/Library/BitLib.dll - it 
                      
                      

                      the direct link doesn't work if I use it like this because of the ending "- it".

                      is the reimport something i do in my actual project or is external work?

                      1 Reply Last reply
                      0
                      • Christian EhrlicherC Offline
                        Christian EhrlicherC Offline
                        Christian Ehrlicher
                        Lifetime Qt Champion
                        wrote on last edited by
                        #30

                        @alexfi said in Library doesn't open:

                        because of the ending "- it".

                        Where does this come from? Your library is named BitLib.dll ...

                        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                        Visit the Qt Academy at https://academy.qt.io/catalog

                        A 1 Reply Last reply
                        0
                        • Christian EhrlicherC Christian Ehrlicher

                          @alexfi said in Library doesn't open:

                          because of the ending "- it".

                          Where does this come from? Your library is named BitLib.dll ...

                          A Offline
                          A Offline
                          AlexFi
                          wrote on last edited by
                          #31

                          @christian-ehrlicher sorry my fault. I just didn't read the following sentence after your recommendation, but i also tried it without and it gave me back undefined reference. Now i try to find out how to reimport the lib.

                          jsulmJ 1 Reply Last reply
                          0
                          • A AlexFi

                            @christian-ehrlicher sorry my fault. I just didn't read the following sentence after your recommendation, but i also tried it without and it gave me back undefined reference. Now i try to find out how to reimport the lib.

                            jsulmJ Offline
                            jsulmJ Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on last edited by
                            #32

                            @alexfi Just a note: the only Kit you have is one for MinGW not MSVC...

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            A 1 Reply Last reply
                            1
                            • jsulmJ jsulm

                              @alexfi Just a note: the only Kit you have is one for MinGW not MSVC...

                              A Offline
                              A Offline
                              AlexFi
                              wrote on last edited by
                              #33

                              @jsulm thank you for your answer. Do I understand this right, that these basic settings should work?

                              1 Reply Last reply
                              0
                              • A Offline
                                A Offline
                                AlexFi
                                wrote on last edited by
                                #34

                                I solved my problem with BitScope. Here a short overview of the setup:

                                First I just downloaded the 32bit library:
                                http://my.bitscope.com/download/?p=download
                                FileType: Drivers&Libraries:
                                bitscope-library_2.0.FE26B_i386.zip

                                ->run the .exe file and a folder is created, in my case in c:/programm files/bitscope.

                                I copied the folder to d:/bitscope, because I thought qt-creator has problems with the space in "programm files", it also works in c:.

                                Then I created a new QT project "QT Widgets Application"
                                For debugging, I use QT.5.13.1 MinGW 32-Bit

                                Modified the .pro file with following:

                                code_text
                                HEADERS += \
                                        bitlib.h
                                INCLUDEPATH +="D:\BitScope\Library"
                                INCLUDEPATH +="D:\BitScope"
                                
                                LIBS +=  "D:\BitScope\Library\BitLib.lib"
                                

                                I copied the "bitlib.h" file of the library folder in the project folder
                                and the "BitLib.dll" in the debug folder of my current project, where you find the .exe file after you build your project the first time.

                                To use the library you just have to add in your .cpp file

                                code_text
                                #include<bitlib.h>
                                
                                #define MY_DEVICES 1 /* open one device only */
                                #define MY_PROBE_FILE "" /* default probe file if unspecified */
                                
                                #define MY_DEVICE 0
                                #define MY_CHANNEL 0
                                #define MY_MODE BL_MODE_FAST
                                #define MY_RATE 5000 /* capture sample rate */
                                #define MY_SIZE 12270 /* number of samples to capture */
                                #define max_SIZE 12270
                                #define n_of_ms 2
                                
                                Project::Project(QWidget *parent) :
                                    QMainWindow(parent),
                                    ui(new Ui::Project)
                                {
                                    ui->setupUi(this);
                                
                                    setUpGrafics();
                                
                                /*
                                     * Open and select the first channel on the first device.
                                     */
                                     printf("\nStarting: Attempting to open %d device%s...\n",MY_DEVICES,MY_DEVICES!=1?"s":"");
                                     QString sVar;
                                     sVar.sprintf("\nStarting: Attempting to open %d device%s...\n",MY_DEVICES,MY_DEVICES!=1?"s":"");
                                
                                     if ( ! BL_Open(MY_PROBE_FILE,MY_DEVICE) ) {
                                
                                            printf("Failed to find a devices.\n");
                                     }
                                     if ( BL_Select(BL_SELECT_DEVICE,MY_DEVICE) != MY_DEVICE ) {
                                         printf("Failed to select device %d.\n",MY_DEVICE);
                                  
                                     }
                                     if ( BL_Select(BL_SELECT_CHANNEL,MY_CHANNEL) != MY_CHANNEL ) {
                                         printf("Failed to select channel %d.\n",MY_CHANNEL);
                                 
                                     }
                                    /*
                                     * Prepare to capture one channel...
                                     */
                                     if ( BL_Mode(MY_MODE) != MY_MODE ) {
                                         printf("Failed to select mode %d.\n",MY_MODE);
                                
                                     }
                                     BL_Intro(BL_ZERO); /* optional, default BL_ZERO */
                                     BL_Delay(BL_ZERO); /* optional, default BL_ZERO */
                                     BL_Rate(MY_RATE); /* optional, default BL_MAX_RATE */
                                     BL_Size(MY_SIZE); /* optional, default BL_MAX_SIZE */
                                     BL_Select(BL_SELECT_CHANNEL,MY_CHANNEL); /* choose the channel */
                                     BL_Trigger(BL_ZERO,BL_TRIG_RISE); /* optional when untriggered */
                                     BL_Select(BL_SELECT_SOURCE,BL_SOURCE_POD); /* use the POD input */
                                     BL_Range(BL_Count(BL_COUNT_RANGE)); /* maximum range */
                                     BL_Offset(BL_ZERO); /* optional, default 0 */
                                     BL_Enable(TRUE); /* at least one channel must be initialised */
                                    /*
                                     * Capture and acquire the data...
                                     */
                                     printf("   Trace: %d samples @ %.0fHz = %fs\n",BL_Size(BL_ASK),BL_Rate(BL_ASK), BL_Time(BL_ASK));
                                     if ( BL_Trace(BL_TRACE_FORCED,BL_SYNCHRONOUS) ) { /* capture data (without a trigger) */
                                          int i, n = MY_SIZE; double d[MY_SIZE]; /* let's get 5 samples */
                                          BL_Select(BL_SELECT_CHANNEL,MY_CHANNEL); /* optional if only one channel */
                                
                                          if ( BL_Acquire(n, d)  == n ) { /* acquire (i.e. dump) the capture data */
                                              printf("Acquired:");
                                              for (i = 0; i < n; i++)
                                                  //printf(" %f", d[i]);
                                            //  printf("\n\n");
                                              Data3.append(d[i+j*n_of_ms]);
                                                 printf(" %f", Data3.value(i));
                                          }
                                
                                      }
                                
                                
                                
                                     printf("Data acquisition complete. Dump Log...\n");
                                     printf(BL_Log());
                                   
                                     BL_Close(); /* call this to release library resources */
                                
                                }
                                

                                I don't know why, but I got troubles when i wanted to call the functions of BitLib.lib in the main.cpp
                                so I just called them in the project.cpp and it worked well.

                                With the sample code of https://www.bitscope.com/software/library/guide/2.0/
                                after I changed in the code the dynamic array to an fixed value and "TRUE" to "true" and deleted the " goto exit," jumps
                                This example runs.

                                Thanks everyone for your help, I hope this will help following BitScope QT users.
                                Have a nice Day!

                                1 Reply Last reply
                                3
                                • A Offline
                                  A Offline
                                  AlexFi
                                  wrote on last edited by
                                  #35

                                  Hello,

                                  i need your help again.
                                  there is one functionality I need from BitScope which is not given in the BitLib, specific I want to switch an output of the BitScope Micro. I got the hint to use https://docs.bitscope.com/LYK5QKSL/#programming but I am not sure, if i can setup this with QT. Do you have any ideas, for that?

                                  kind regards

                                  alex

                                  Pablo J. RoginaP 1 Reply Last reply
                                  0
                                  • A AlexFi

                                    Hello,

                                    i need your help again.
                                    there is one functionality I need from BitScope which is not given in the BitLib, specific I want to switch an output of the BitScope Micro. I got the hint to use https://docs.bitscope.com/LYK5QKSL/#programming but I am not sure, if i can setup this with QT. Do you have any ideas, for that?

                                    kind regards

                                    alex

                                    Pablo J. RoginaP Offline
                                    Pablo J. RoginaP Offline
                                    Pablo J. Rogina
                                    wrote on last edited by
                                    #36

                                    @AlexFi please open your own post for this new topic. Thanks.

                                    Upvote the answer(s) that helped you solve the issue
                                    Use "Topic Tools" button to mark your post as Solved
                                    Add screenshots via postimage.org
                                    Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                                    1 Reply Last reply
                                    2

                                    • Login

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