简体   繁体   English

Qt Creator找不到库文件

[英]Qt Creator can't find library file

I have added a lib like this in my .pro file: 我在.pro文件中添加了这样的库:

unix {
    LIBS += ../lib_dir/myLib.a

    //other includes not related to this
}

And when I try to build I get "undefined reference" errors for every function used from this lib and an error: 当我尝试构建时,此库使用的每个函数都会收到“未定义的引用”错误和一个错误:

File not found: ../lib_dir/myLib.a(myLib.o)

What could I be doing wrong? 我可能做错了什么?

EDIT : 编辑

Here is what I have written: 这是我写的:

LIBS += -L../lib_dir -lmyLib 

Here is the file path: 这是文件路径:

/home/livanov/Project/lib_dir/myLib.a 

Here is the path of my project that uses the lib: 这是我使用lib的项目的路径:

/home/livanov/Project/client_app

Try using the form described in qmake's variable reference : 尝试使用qmake的变量参考中描述的形式:

unix {
    LIBS += -L../lib_dir -lmyLib
}

If the path to your library contains spaces, use quotes: 如果您的库路径包含空格,请使用引号:

unix {
    LIBS += "-L../lib dir" -lmyLib
}

If that doesn't work, we'll need to see the actual path to your library. 如果这不起作用,我们需要查看您的库的实际路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM