0

I am working on Qt project. I have installed QJson successfully. And have used parser to parse the data.My code get compiled successfully but at run time it is giving me following error:

dyld: Library not loaded: libqjson.0.dylib

Referenced from: /Users/sanjay/untitled1-build-desktop-Qt_4_8_3_in_PATH_System_Debug/untitled1.app/Contents/MacOS/untitled1

Reason: image not found

I have added library as external library in Qt creater. It added following code to my .pro file:

macx: LIBS += -L$$PWD/../build/_preferred_path_/lib/ -lqjson

INCLUDEPATH += $$PWD/../build/_preferred_path_/include/qjson

DEPENDPATH += $$PWD/../build/_preferred_path_/include/qjson

Could anybody tell me please What am I doing wrong?

3 Answers 3

0

Make sure the library is located with your application's app file. Give full path names like LIBS += "lib/libqjson.dylib"

I used the above directive and it worked for me.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi Aakash .thanx for your quick reply. As you said I have copied my lib and include folder into the folder containing my .app file. But still it is giving me the same error.
0

If your application compiles successfully then it means that project configuration defined in pro file is correct (including LIBS configuration).

In this case your application fails on runtime, so that means means that libqjson.0.dylib could not be found in library path. First check how json library is linked with your library using otool tool (http://tech-queries.blogspot.com/2011/04/dynamic-library-dependency-on-mac-os-x.html). This tool will help you to detect the problem, after detection you may:

relinking of library step may be set as post build step in in pro file. Here is example:

macx {
    QMAKE_POST_LINK = install_name_tool -change libqjson.0.dylib @loader_path/relative_path_to_library/libqjson.0.dylib  your_binary_file

Comments

0

In Terminal, type this:

otool -L /Users/sanjay/untitled1-build-desktop-Qt_4_8_3_in_PATH_System_Debug/untitled1.app/Contents/MacOS/untitled1

It will tell you where each of the dependent libraries is expected to be.

1 Comment

Hi stephen I have tried this already. It is giving me path for all other libraries but not for libqjson.0.dylib.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.