[Moved] Compile Errors while using a standard C++ Library
-
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?
-
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 = appSOURCES += main.cpp
mainterm.cpp
portmaster.cpp
markmachine.cpp
globalvar.cppHEADERS += mainterm.h
include/serialportinfo.h
include/serialport.h
portmaster.h
markmachine.h
globalvar.h
iec16022-n.hinclude(src/src.pri)
FORMS += mainterm.ui
OTHER_FILES +=
-
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. -
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.
@
// .proINCLUDEPATH += <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.