Libjson Library
-
Hi,
You can't use libraries built on linux on windows (unless you cross-compiled them for windows)
Since you are using MinGW, why not run mingw32-make in the libjson folder ?
-
That was my original idea, but i couldnt get mingw32-make to work.
I have the mingw that got installed on the Qt bundle, and theres no mingw32-make at all. Ive downloaded one from here
http://sourceforge.net/projects/mingw/files/MinGW/Extension/make/
but when I try to use it it tells me its missing libintl-8.dll, and that I should reinstall the application.Is there any plugin or addon I should add to my Mingw installation to make the "make" work?
-
IIRC Qt 4 doesn't come with MinGW it's the Qt 5 installer that provides it (but you can use it for both)
-
Ok, I completly uninstalled my MinGW, and downloaded it again, with all the additional stuff I could select. This time it came with the mingw32-make, and I was able to build the library perfectly, yet it still gives the same errors.
First of all, I just copied the libjson.a to the library folder, it didnt work.
Then, I simply included all the files that I obtained by building the library, and I Manually added them to the project, still with the same results.
These files are:
json.c
json.g
json.o
jsonlint.c
jsonlint.o
libjson.a
libjson.pc
libjson.pc.inIm having the "undefined reference to 'function name' "error, with functions that are from libjson. Whats weird, is that I cant find myself these functions.
For example, I have the following error:
bq. undefined reference to 'json_tokener_parse(char*)'
This function is declared on json_tokener.h (a file that came with the project im trying to compile), and that I included on the same file where im having the error, just in case.
Its declared on the following way
@extern struct json_object* json_tokener_parse(char *str);@
So that means that the "Body" of the function must me somewhere. I did a string search, using cmd, and the command findstr. I first placed myself on the project directory, and typed
@findstr /s /i /p /c:"tokener_parse" .@And from all of the results, none of them where the function itself, only places where this function is called. So indeed, these functions are missing, but my question is... Where are them?
I clearly dont understand something about how to compile libraries, and how they should work. Could someone point me in the right direction? Im going to sum up what I did so far-
I downloaded Libjson library from http://projects.snarc.org/libjson/download/
-
I fixed my MinGW, by uninstalling it and installing it again, with all optional stuff checked.
-
I opened a cmd window, placed myself on the library directory (where i can find a makefile) and made the mingw32-make, the libjson.a appeared
4)I placed the libjson.a where my Qt program was looking for it, and rebuilt the project. Now it could find the library, but started giving me the undefined reference to "function name".
- I copied and pasted all of the files (that I listed before) to my project directory, and from QtCreator right clicked on the project, and went to add files, and added all of them. Rebuilt. Still same error
Thats a summary of what ive tried, with no luck so far... What am I doing wrong? How does sombody usually add a library to a project? Which files should i add in the .pro file and what #includes should I place?
Thanks in advance!
-
-
Since you built it successfully on Fedora, check where does their libjson come from.
-
Ok then, can you show your pro file ?
-
@template = app
CONFIG += qt
CORELIBDIR = ../kiax2core
INCLUDEPATH += $$CORELIBDIR $$CORELIBDIR/includes $$CORELIBDIR/includes/json $$CORELIBDIR/dottelutilsset USEWEBKIT to true if you want to link to webkit shared library
USEWEBKIT = false
win32 {
LIBSDIR += $$CORELIBDIR/libs-windows
LIBS += $$LIBSDIR/iaxclient.dll $$LIBSDIR/sqlite3.dll $$CORELIBDIR/release/libkiax2core.a $$LIBSDIR/libjson.a $$LIBSDIR/libcurl-4.dll -leay32 -lssleay32
LIBS+= -LC:/OpenSSL-Win32/lib/MinGW
LIBS+= -LC:/OpenSSL-Win32/lib
DEFINES += WIN32DEP
}KIAXOPT += dottel
contains( KIAXOPT, dottel ): {
message("Enabling dottel support..")
DEFINES += USE_DOTTEL
HEADERS += Kiax2DotTelDialog.h
../kiax2core/dottelutils/dottelutils.h
../kiax2core/dottelutils/CppDotTelutils.h
SOURCES += Kiax2DotTelDialog.cppFORMS += dotteldialog.ui
INCLUDEPATH += voip/ldns-1.4.0
win32 {
LIBS += $$LIBSDIR/libldns.a -lwsock32 -liphlpapi
}
}comment if you don't have hold() in your iaxclient
DEFINES += IAXCLIENT_HOLD_HACK
QT += network
contains( KIAXOPT, webforms ): {
message("Using Webforms + WebKit..")
QT += webkit
DEFINES += USE_WEBFORMS
HEADERS += Kiax2ChangePassDialog.cpp
Kiax2RegisterDialog.h
SOURCES += Kiax2ChangePassDialog.cpp
Kiax2RegisterDialog.cpp
}contains( KIAXOPT, webfeed ): {
message("Using Webfeed + WebKit..")
QT += webkit
DEFINES += USE_WEBFEED
}FORMS += kiax2windowAlt.ui
accountdialog.ui
aboutdialog.ui
calldialog.ui
contactdialog.ui
contactlistitemwidget.ui
settingsdialog.ui
registerdialog.ui
loginscreen.uiHEADERS += Kiax2MainWindow.h
Kiax2AboutDialog.h
Kiax2AccountDialog.h
Kiax2CallDialog.h
Kiax2ContactDialog.h
Kiax2ListWidgetItem.h
Kiax2ContactListItemWidget.h
Kiax2SettingsDialog.h
IAX2CallbackHandlerQt.h
Kiax2ConnectionMeter.h
Kiax2JSONBalance.h
Kiax2LoginScreen.h
Kiax2Application.h
Kiax2JSONUsersOnline.h
kiax2JSONNotification.h
Kiax2JSONServers.h
Kiax2DispatcherServer.h
Kiax2DispatcherThread.h
Kiax2Servers.h
Kiax2JSONSupernode.h
Kiax2CallAppearance.h
Kiax2CallDialogView.h
Kiax2CallButton.h
../kiax2core/PConfiguration.h
Flashiadas/json.hSOURCES += Kiax2MainWindow.cpp
Kiax2AboutDialog.cpp
Kiax2AccountDialog.cpp
Kiax2CallDialog.cpp
Kiax2ContactDialog.cpp
Kiax2ListWidgetItem.cpp
Kiax2ContactListItemWidget.cpp
Kiax2SettingsDialog.cpp
IAX2CallbackHandlerQt.cpp
Kiax2ConnectionMeter.cpp
Kiax2JSONBalance.cpp
Kiax2LoginScreen.cpp
Kiax2Application.cpp
Kiax2JSONUsersOnline.cpp
Kiax2JSONNotification.cpp
Kiax2JSONServers.cpp
Kiax2DispatcherServer.cpp
Kiax2DispatcherThread.cpp
Kiax2Servers.cpp
Kiax2JSONSupernode.cpp
Kiax2CallAppearance.cpp
Kiax2CallDialogView.cpp
Kiax2CallButton.cpp
Flashiadas/json.c
Flashiadas/jsonlint.cRC_FILE = kiax2.rc
TRANSLATIONS = kiax2_fr.ts
kiax2_de.ts
kiax2_es.tsbuild_all:!build_pass {
CONFIG -= build_all
CONFIG += release windows
}install
target.path = .
sources.files = $$SOURCES $$HEADERS $$FORMS *.pro
sources.path = .
INSTALLS += targetOTHER_FILES +=
../kiax2core/libs-windows/libjson.a
Flashiadas/json.o
Flashiadas/jsonlint.o
Flashiadas/libjson.a
Flashiadas/libjson.so
Flashiadas/libjson.so.0
Flashiadas/libjson.so.0.8
Flashiadas/libjson.so.0.8.0
Flashiadas/libjson.pc
Flashiadas/libjson.pc.in
@ -
Are you sure $$LIBSDIR/libjson.a is correct ?
-
Probably it isnt, that kind of the point in here. I got that libjson.a after compiling with mingw (mingw32-make) the library Ive downloaded from internet from here http://projects.snarc.org/libjson/download/
Im not sure if it doesnt work because the file is incorrect, or if i should be adding something else to the folder... a .h or .o maybe?
Are the steps I made incorrect?