Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. [Moved] Compile Errors while using a standard C++ Library
Forum Update on Monday, May 27th 2025

[Moved] Compile Errors while using a standard C++ Library

Scheduled Pinned Locked Moved Qt Creator and other tools
9 Posts 3 Posters 3.5k 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.
  • K Offline
    K Offline
    kpkale
    wrote on 14 Jan 2012, 08:47 last edited by
    #1

    I am programming in QT Creator with C++. I have a standard library for barcode encoding that i require to use along with the software I am writing. However, when I include the library in my software and compile, I get a lot of errors... Do I need to make changes to the standard C++ Library for using with Qt?

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rahul Das
      wrote on 14 Jan 2012, 09:13 last edited by
      #2

      Welcome to The Forum.

      What kind of errors are you getting? How does your pro file look like?


      Declaration of (Platform) independence.

      1 Reply Last reply
      0
      • K Offline
        K Offline
        kpkale
        wrote on 14 Jan 2012, 09:45 last edited by
        #3

        The following is the list of errors and warnings..
        I had to delete a lot of warnings as the post was too large... but the errors are included...
        ../serterminal/iec16022-n.h: In function 'char ecc200encode(unsigned char*, int, unsigned char*, int, char*, int*)':
        ../serterminal/iec16022-n.h:372: warning: comparison between signed and unsigned integer expressions
        ../serterminal/iec16022-n.h:380: warning: suggest parentheses around '&&' within '||'
        ../serterminal/iec16022-n.h:411: warning: array subscript has type 'char'
        ../serterminal/iec16022-n.h:412: warning: array subscript has type 'char'
        ../serterminal/iec16022-n.h:414: error: invalid conversion from 'const char*' to 'char*'
        ../serterminal/iec16022-n.h:416: warning: array subscript has type 'char'
        ../serterminal/iec16022-n.h:423: warning: array subscript has type 'char'
        ../serterminal/iec16022-n.h:424: warning: array subscript has type 'char'
        ../serterminal/iec16022-n.h:426: error: invalid conversion from 'const char*' to 'char*'
        ../serterminal/iec16022-n.h:428: warning: array subscript has type 'char'
        ../serterminal/iec16022-n.h:429: warning: array subscript has type 'char'
        ../serterminal/iec16022-n.h:432: error: invalid conversion from 'const char*' to 'char*'
        ../serterminal/iec16022-n.h:434: warning: array subscript has type 'char'
        ../serterminal/iec16022-n.h:436: warning: array subscript has type 'char'
        ../serterminal/iec16022-n.h:449: warning: array subscript has type 'char'
        ../serterminal/iec16022-n.h: At global scope:
        ../serterminal/iec16022-n.h:600: warning: missing braces around initializer for 'unsigned char [6]'
        ../serterminal/iec16022-n.h: In function 'char* encmake(int, unsigned char*, int*, char)':
        ../serterminal/iec16022-n.h:634: warning: deprecated conversion from string constant to 'char*'
        ../serterminal/iec16022-n.h:910: warning: array subscript has type 'char'

        and my pro file is as follows:

        #-------------------------------------------------

        Project created by QtCreator 2011-12-21T12:53:54

        #-------------------------------------------------

        QT += core gui

        TARGET = serterminal
        TEMPLATE = app

        SOURCES += main.cpp
        mainterm.cpp
        portmaster.cpp
        markmachine.cpp
        globalvar.cpp

        HEADERS += mainterm.h
        include/serialportinfo.h
        include/serialport.h
        portmaster.h
        markmachine.h
        globalvar.h
        iec16022-n.h

        include(src/src.pri)

        FORMS += mainterm.ui

        OTHER_FILES +=

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Rahul Das
          wrote on 14 Jan 2012, 10:13 last edited by
          #4

          And where are your libraries?
          @LIBS += @


          Declaration of (Platform) independence.

          1 Reply Last reply
          0
          • K Offline
            K Offline
            kpkale
            wrote on 14 Jan 2012, 10:23 last edited by
            #5

            iec16022.h is the only file provided for the library..
            This file contains all the functions that I need to call.
            It has not been specified as a library..

            1 Reply Last reply
            0
            • R Offline
              R Offline
              Rahul Das
              wrote on 14 Jan 2012, 10:45 last edited by
              #6

              Ok. you can try to cast 'const char*' to 'char* . As you know const char* and char* are not exactly same.


              Declaration of (Platform) independence.

              1 Reply Last reply
              0
              • L Offline
                L Offline
                lgeyer
                wrote on 14 Jan 2012, 19:15 last edited by
                #7

                This doesn't sound like a Qt Creator related problem. As far as I can judge from the errors and warnings you've posted the library or header file you've got does not fully respect the C++ standard, and the compiler rightly complains about it.

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  kpkale
                  wrote on 14 Jan 2012, 19:44 last edited by
                  #8

                  Hi Lukas

                  On analysis, I also feel the same way... Now in order to use the library, I am planning to try compile the library using the Linux GCC and the use the same in my program.
                  Do you feel this approach would be right.. the library that I have is in OpenSource and has been used by many... in fact you can also load the command line utility of the same library in your Linux.
                  Moreover, I dont know at present how to use a library compiled for Linux with QT.

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    lgeyer
                    wrote on 15 Jan 2012, 14:30 last edited by
                    #9

                    It depends. There is no (technical) problem in using the library directly by linking your application against it, but you may run into licensing issues (for example GPL requires you to go GPL or alike for your application as well) which might be avoided by calling it as an external binary.

                    A proper .pro file is all that needs to be done for linking against external libraries, QProcess can be used to call external binaries.

                    @
                    // .pro

                    INCLUDEPATH += <path-to-library-include-files>

                    LIBS += -L<path-to-precompiled-library>
                    LIBS += -l<name-of-precompiled-library>

                    // .cpp

                    #include "iec16022-n.h"
                    @
                    Just make sure you use the same compiler to compile the library and your application.

                    1 Reply Last reply
                    0

                    1/9

                    14 Jan 2012, 08:47

                    • Login

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