Results 1 to 11 of 11

Thread: problem creating a qjson0.lib

  1. #1
    Join Date
    Mar 2014
    Posts
    12
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default problem creating a qjson0.lib

    Hi, i am trying to generate a lib from this project https://github.com/flavio/qjson with Qt5.2.1 and msvc2010 compiler.

    Can anyone assist? I build the project without problems but there is no qjson0.lib, i need it for this project to work. https://code.google.com/p/qt-google-maps/

    This is the developers site.
    Last edited by Qg90; 15th March 2014 at 22:06.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: problem creating a qjson0.lib

    That's probably because it is called qjson.lib at a guess.

  3. #3
    Join Date
    Mar 2014
    Posts
    12
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: problem creating a qjson0.lib

    This is inside the pro file.
    win32-g++ {
    LIBS += ../qjson/build/lib/qjson0.dll
    }

    win32-msvc* {
    LIBS += ../qjson/build/lib/qjson0.lib
    }

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: problem creating a qjson0.lib

    So? What does the QJson project actually build?

  5. #5
    Join Date
    Mar 2014
    Posts
    12
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: problem creating a qjson0.lib

    It's supposed to build a library. I'm using the CLI way found here.

    at the "mingw32-make" command i get this error.
    C:\Users\George\Desktop\qjson\build>mingw32-make
    Scanning dependencies of target qjson_automoc
    [ 11%] Automoc for target qjson
    Generating moc_parserrunnable.cpp
    Generating moc_qobjecthelper.cpp
    C:/Users/George/Desktop/qjson/src/qobjecthelper.h(0): Note: No relevant classes
    found. No output generated.
    Generating moc_serializerrunnable.cpp
    [ 11%] Built target qjson_automoc
    Scanning dependencies of target qjson
    [ 22%] Building CXX object src/CMakeFiles/qjson.dir/parser.cpp.obj
    [ 33%] Building CXX object src/CMakeFiles/qjson.dir/qobjecthelper.cpp.obj
    [ 44%] Building CXX object src/CMakeFiles/qjson.dir/json_scanner.cpp.obj
    [ 55%] Building CXX object src/CMakeFiles/qjson.dir/json_parser.cc.obj
    [ 66%] Building CXX object src/CMakeFiles/qjson.dir/parserrunnable.cpp.obj
    [ 77%] Building CXX object src/CMakeFiles/qjson.dir/serializer.cpp.obj
    [ 88%] Building CXX object src/CMakeFiles/qjson.dir/serializerrunnable.cpp.obj
    [100%] Building CXX object src/CMakeFiles/qjson.dir/qjson_automoc.cpp.obj
    Linking CXX shared library libqjson.dll
    CMakeFiles\qjson.dir/objects.a(parser.cpp.obj):parser.cpp:(.text+0x4b): undefine
    d reference to `_imp___ZN8QVariantD1Ev'
    CMakeFiles\qjson.dir/objects.a(parser.cpp.obj):parser.cpp:(.text+0xa8): undefine
    d reference to `_imp___ZN8QVariantD1Ev'
    CMakeFiles\qjson.dir/objects.a(parser.cpp.obj):parser.cpp:(.text+0xc8): undefine
    d reference to `_imp___ZN8QVariantD1Ev'
    CMakeFiles\qjson.dir/objects.a(parser.cpp.obj):parser.cpp:(.text+0x10f) : undefin
    ed reference to `_imp___ZN7QStringaSERKS_'
    CMakeFiles\qjson.dir/objects.a(parser.cpp.obj):parser.cpp:(.text+0x213) : undefin
    ed reference to `_imp___ZNK9QIODevice6isOpenEv'
    CMakeFiles\qjson.dir/objects.a(parser.cpp.obj):parser.cpp:(.text+0x298) : undefin
    ed reference to `_imp___ZNK14QMessageLogger8criticalEPKcz'
    CMakeFiles\qjson.dir/objects.a(parser.cpp.obj):parser.cpp:(.text+0x2b6) : undefin
    ed reference to `_imp___ZNK9QIODevice10isReadableEv'
    CMakeFiles\qjson.dir/objects.a(parser.cpp.obj):parser.cpp:(.text+0x302) : undefin
    ed reference to `_imp___ZNK14QMessageLogger8criticalEPKcz'
    CMakeFiles\qjson.dir/objects.a(parser.cpp.obj):parser.cpp:(.text+0x49d) : undefin
    ed reference to `_imp___ZN8QVariantC1ERKS_'
    CMakeFiles\qjson.dir/objects.a(parser.cpp.obj):parser.cpp:(.text+0x51d) : undefin
    ed reference to `_imp___ZN7QBufferC1EP7QObject'
    CMakeFiles\qjson.dir/objects.a(parser.cpp.obj):parser.cpp:(.text+0x546) : undefin
    ed reference to `_imp___ZN7QBuffer4openE6QFlagsIN9QIODevice12OpenM odeFlagEE'
    CMakeFiles\qjson.dir/objects.a(parser.cpp.obj):parser.cpp:(.text+0x577) : undefin
    ed reference to `_imp___ZN7QBuffer4seekEx'
    CMakeFiles\qjson.dir/objects.a(parser.cpp.obj):parser.cpp:(.text+0x5a7) : undefin
    ed reference to `_imp___ZN7QBufferD1Ev'
    CMakeFiles\qjson.dir/objects.a(parser.cpp.obj):parser.cpp:(.text+0x5bb) : undefin
    ed reference to `_imp___ZN7QBufferD1Ev'
    c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: CMakeFiles
    \qjson.dir/objects.a(parser.cpp.obj): bad reloc address 0x10 in section `.text$_
    ZN14QMessageLoggerC1EPKciS1_[__ZN14QMessageLoggerC1EPKciS1_]'
    collect2.exe: error: ld returned 1 exit status
    src\CMakeFiles\qjson.dir\build.make:272: recipe for target 'src/libqjson.dll' fa
    iled
    mingw32-make[2]: *** [src/libqjson.dll] Error 1
    CMakeFiles\Makefile2:109: recipe for target 'src/CMakeFiles/qjson.dir/all' faile
    d
    mingw32-make[1]: *** [src/CMakeFiles/qjson.dir/all] Error 2
    Makefile:115: recipe for target 'all' failed
    mingw32-make: *** [all] Error 2
    Last edited by Qg90; 16th March 2014 at 11:55.

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: problem creating a qjson0.lib

    So you are not using MSVC 2010, you are trying to build with MingW. QJson is failing to link because it looks like CMake has not correctly located Qt, or has created an incorrect linker command.

    If it had compiled and linked (it has not) then the resulting library file is libqjson.dll and the reference from the other project should not include the zero.
    Qt Code:
    1. LIBS += -Lc:/path/to/qjson -lqjson
    To copy to clipboard, switch view to plain text mode 

  7. #7
    Join Date
    Mar 2014
    Posts
    12
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: problem creating a qjson0.lib

    Correct i am using the commands on the CLI example. I installed the MinGW compiler outside the Qt and i used it. This is the output from the "cmake -G "MinGW-make" .." command.
    C:\Users\George\Desktop\qjson\build>cmake -G "MinGW Makefiles" ..
    -- The C compiler identification is GNU 4.8.1
    -- The CXX compiler identification is GNU 4.8.1
    -- Check for working C compiler: C:/MinGW/bin/gcc.exe
    -- Check for working C compiler: C:/MinGW/bin/gcc.exe -- works
    -- Detecting C compiler ABI info
    -- Detecting C compiler ABI info - done
    -- Check for working CXX compiler: C:/MinGW/bin/g++.exe
    -- Check for working CXX compiler: C:/MinGW/bin/g++.exe -- works
    -- Detecting CXX compiler ABI info
    -- Detecting CXX compiler ABI info - done
    Qt5 found
    -- Configuring done
    -- Generating done
    -- Build files have been written to: C:/Users/George/Desktop/qjson/build
    Also i used cmake gui and this is the output:
    The C compiler identification is MSVC 16.0.40219.1
    The CXX compiler identification is MSVC 16.0.40219.1
    Check for working C compiler using: Visual Studio 10
    Check for working C compiler using: Visual Studio 10 -- works
    Detecting C compiler ABI info
    Detecting C compiler ABI info - done
    Check for working CXX compiler using: Visual Studio 10
    Check for working CXX compiler using: Visual Studio 10 -- works
    Detecting CXX compiler ABI info
    Detecting CXX compiler ABI info - done
    Qt5 found
    Configuring done
    Generating done
    Now on the build file i have vc projects.


    Added after 53 minutes:


    I opened the msvc 2010 as an administrator and built the solution and i got a C:\Program Files (x86)\qjson folder with a qjson.lib include. I added the lib but my app crashes before it starts.
    I added the LIBS += -Lc:/path/to/qjson -lqjson but i get the following error

    :-1: error: LNK1104: cannot open file 'qjson.lib'
    Last edited by Qg90; 17th March 2014 at 00:11.

  8. #8
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: problem creating a qjson0.lib

    Please tell me you did not literally put:
    Qt Code:
    1. LIBS += -Lc:/path/to/qjson -lqjson
    To copy to clipboard, switch view to plain text mode 
    in your PRO file. Given the path you specified:
    Qt Code:
    1. LIBS += -L"C:\Program Files (x86)\qjson" -lqjson
    To copy to clipboard, switch view to plain text mode 

  9. #9
    Join Date
    Mar 2014
    Posts
    12
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: problem creating a qjson0.lib

    Of course i didn't put just LIBS += -Lc:/path/to/qjson -lqjson i specified the path to this LIBS += ../qjson/qjson.lib. The build was completed without errors but when i run the program i get this error:
    Starting C:\Users\George\Desktop\build-qt-google-maps-Desktop_Qt_5_2_1_MSVC2010_32bit_OpenGL2-Debug\debug\qtmaps.exe...
    The program has unexpectedly finished.
    C:\Users\George\Desktop\build-qt-google-maps-Desktop_Qt_5_2_1_MSVC2010_32bit_OpenGL2-Debug\debug\qtmaps.exe crashed
    Also i used your line in the PRO file but i didn't built.
    :-1: error: LNK1104: cannot open file 'qjson.lib'

  10. #10
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: problem creating a qjson0.lib

    You have two projects.

    The first is one that builds QJSon. You should not need to modfiy the project to build QJson at all.
    I am assuming you have successfuly built QJSon and obtained a qjosn link library, and a matching DLL if t QJSon was built for dynamic linking.

    The other is the qtmaps thingy that consumes QJson. It is the second project that the LIBS line is for, and only if the one that is there already is incorrect. The path following -L tells the linker a directory to search when look for the link library specified by the -l option. The paths and library name must be correct or you get the linker complaining about missing dependencies. If you use a relative path then it is relative to wherever the build process happens to have its current directory at link time: this may not be relative to the source and may not be where you think it is.

    If you have successfully built qtmaps (it really is not clear) then none of the preceding stuff matters any more.

    If QJSon was built as a dynamic library then at run time the qtmaps program must be able to find the QJson DLL that matches the link library. The DLL must either be in the same directory as the qtmaps.exe or on the PATH the qtmaps.exe is run with.

  11. The following user says thank you to ChrisW67 for this useful post:

    Qg90 (19th March 2014)

  12. #11
    Join Date
    Mar 2014
    Posts
    12
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: problem creating a qjson0.lib

    Quote Originally Posted by ChrisW67 View Post
    If QJSon was built as a dynamic library then at run time the qtmaps program must be able to find the QJson DLL that matches the link library. The DLL must either be in the same directory as the qtmaps.exe or on the PATH the qtmaps.exe is run with.
    You sir are my hero!!!!!!! This line did the trick. I put the qjson.dll on the same directory as the qtmaps.exe and it run!!!!!!

Similar Threads

  1. problem in creating xml file.
    By Niamita in forum Qt Programming
    Replies: 1
    Last Post: 6th September 2011, 15:18
  2. Problem in creating a QFileSystemModel
    By kamlmish in forum Newbie
    Replies: 1
    Last Post: 16th December 2010, 15:03
  3. Problem When Creating my own Slot
    By Fatla in forum Qt Programming
    Replies: 12
    Last Post: 6th June 2008, 14:44
  4. creating dll problem -> no exports ...
    By vrudolf in forum Qt Programming
    Replies: 2
    Last Post: 30th July 2006, 16:47

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.