0

In my .pro file in Qt project, I have used these two lines for adding necessary LIBS.

LIBS          += -L "../../lib/bin/libname.a"  
LIBS          +=  -L "../../rfm2g/winver/libname.lib"  
error: ../../rfm2g/winver/libname.lib: No such file or directory  

The compiler found the file libname.a, but could not find the libname.lib, although the relative path for both files is correct. Does anybody have an idea?

IAmInPLS
  • 4,051
  • 4
  • 24
  • 57
Waleed A
  • 95
  • 10

1 Answers1

1

The -L option wants a directory for -l to search, not the path to the actual library.

So you should either write e.g.

LIBS += -L../../lib/bin -lname
LIBS += -L../../rfm2g/winver -lothername

Or link with them directly

LIBS += ../../lib/libname.a
LIBS += ../../rfm2g/winver/libname.lib

Also make sure that the paths actually are correct. If you change to the build directory, and try to list the files (using ls or dir depending on platform) using the paths you have, can you list both files?

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
  • @WaleedA Then you have to consider the possibility that the directory or file-name is actually wrong, or you don't have permissions to read the file or one of the directories in the path. – Some programmer dude Jun 25 '15 at 13:18
  • Pileborgthe path is correct, i m working on windows. and the relative path is starting from the .pro file location. so what do mena by the build directory? – Waleed A Jun 25 '15 at 13:19
  • the first file libname.a has no problem , and the compiler can read it correctly, but the second file libname.lib has the problem and can not be found by the compiler – Waleed A Jun 25 '15 at 13:21
  • @WaleedA In this case, the directory where the `.pro` file is located. – Some programmer dude Jun 25 '15 at 13:21
  • how do you know that the first one is being loaded? Maybe it evaluates them backwards. Try switching the lines – Luis Sieira Jun 25 '15 at 13:39
  • when i add the static path e.g., LIBS += c:/path/rfm2g/winver/libname.lib then it compiles without prolem, whey with the relative path does not work – Waleed A Jun 25 '15 at 14:09