Using external ANSI C library
Hello,
It's possible to include in a Qt project an external library written in ANSI C??
I tried it writting,
Code:
#include "library.h"
in my source program, and inserting
Code:
LIBS += -Llibrary.lib
in my project definition.
When I compile the project, it seems that Qt finds the library correctly, but I get the followings error messages
Code:
undefined reference to 'library_function@8'
Help me please!! Thanks!!
Re: Using external ANSI C library
HI, you have to provide "external linkage" information to your compiler
Try with
Code:
extern "C" {
#include "library.h"
}
Notice that the correct syntax for linking libraries in .pro file is
Code:
LIBS += -L<library_path> -l<library_basename>
Eg
Code:
LIBS += -Llibs/ -llibrary
Re: Using external ANSI C library
Do you state the fact that the library is a C-style library (rather than C++) in the header file or before the #include statement?
Eg.
Code:
extern "C" {
#include "mylib.h"
};