Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Libjson Library
Forum Updated to NodeBB v4.3 + New Features

Libjson Library

Scheduled Pinned Locked Moved Installation and Deployment
11 Posts 2 Posters 4.9k Views 1 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    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 ?

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • D Offline
      D Offline
      darkp03
      wrote on last edited by
      #3

      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?

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #4

        IIRC Qt 4 doesn't come with MinGW it's the Qt 5 installer that provides it (but you can use it for both)

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • D Offline
          D Offline
          darkp03
          wrote on last edited by
          #5

          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.in

          Im 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

          1. I downloaded Libjson library from http://projects.snarc.org/libjson/download/

          2. I fixed my MinGW, by uninstalling it and installing it again, with all optional stuff checked.

          3. 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".

          1. 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!

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #6

            Since you built it successfully on Fedora, check where does their libjson come from.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • D Offline
              D Offline
              darkp03
              wrote on last edited by
              #7

              I dont understand that, ive managed to build the library succesfully both on windows and on fedora, but i never got it working on my project

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #8

                Ok then, can you show your pro file ?

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                1 Reply Last reply
                0
                • D Offline
                  D Offline
                  darkp03
                  wrote on last edited by
                  #9

                  @template = app
                  CONFIG += qt
                  CORELIBDIR = ../kiax2core
                  INCLUDEPATH += $$CORELIBDIR $$CORELIBDIR/includes $$CORELIBDIR/includes/json $$CORELIBDIR/dottelutils

                  set 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.cpp

                  FORMS += 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.ui

                  HEADERS += 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.h

                  SOURCES += 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.c

                  RC_FILE = kiax2.rc

                  TRANSLATIONS = kiax2_fr.ts
                  kiax2_de.ts
                  kiax2_es.ts

                  build_all:!build_pass {
                  CONFIG -= build_all
                  CONFIG += release windows
                  }

                  install

                  target.path = .
                  sources.files = $$SOURCES $$HEADERS $$FORMS *.pro
                  sources.path = .
                  INSTALLS += target

                  OTHER_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
                  @

                  1 Reply Last reply
                  0
                  • SGaistS Offline
                    SGaistS Offline
                    SGaist
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    Are you sure $$LIBSDIR/libjson.a is correct ?

                    Interested in AI ? www.idiap.ch
                    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                    1 Reply Last reply
                    0
                    • D Offline
                      D Offline
                      darkp03
                      wrote on last edited by
                      #11

                      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?

                      1 Reply Last reply
                      0

                      • Login

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