PDA

View Full Version : qmake is not finding some existing libraries



Momergil
8th September 2014, 21:35
I'm having a problem when including two libraries (not made by me) into my (pure C) project in Qt Creator (using qmake + GCC on Linux Ubuntu).

I know that, to include a lib, one uses the LIBS directive as explained in this SO answer; and I have successfully inserted libraries both in Linux as well as in Windows this way. Even more, in this same problematic project I have two successfully inserted libraries.

But now I'm having a problem including this two other libs in this same project. One of this libraries is C6RUN, required for conversation between two processors, and inside the library's folder there is a /bin and a /lib folder; the first has some files with no extension (they are not a .a or .lib) while the second have, inside two child folders, a set of .a . The other library is inside a folder with a /lib subfolder with a .lib inside. Both of them are working 100% in a project in Eclipse (so no qmake/Qt Creator involved). I mentioned the /bin folder of the first library because in a Makefile related to the Eclipse-based project two of its files are referenced despite not being formally library files.

When trying to link both libraries in the .pro, I do EXACTLY the same thing as always: add the path with -L plus the name of the lib with -l. When I try to do that with those two libs, errors occur. What follows is the list with actions + results (actually I tried even some other options, but none of the results were different from the two shown below):



First lib 1

.pro

LIBS += -L$${COMMON_PATH}/linux-devkit/c6run/lib/c6run_dsp -llibc6run

result

error: connot find -llibc6run



First lib 2

.pro

LIBS += -L$${COMMON_PATH}/linux-devkit/c6run/lib/c6run_dsp -lc6run

result

compiles fine.

when calling a respective method inside main.cpp / int main():

error: undefined reference of <method name>



First lib 3

.pro

LIBS += -L$${COMMON_PATH}/linux-devkit/c6run/bin -lc6runlib-ar

result

error: connot find -lc6runlib-ar



Second lib 1

.pro

LIBS += -L$${RE8K_REPO}/main_projects/lib_calc_dsp/lib -lcalculos

result

error: connot find -lcalculos



Second lib 2

.pro

LIBS += -L$${RE8K_REPO}/main_projects/lib_calc_dsp/lib/calculos.lib

result

compiles fine.

when calling a respective method inside main.cpp / int main():

error: undefined reference of <method name>


So, what could I be missing?

wysota
9th September 2014, 07:02
.lib files are likely for Windows. .a files are static archives and not dynamically loaded objects. Try referring to them directly without the -l prefix and provide full name including the extension. Be careful, if the libraries depend on each other then the order of passing them to the compiler matters!