4

I have a C++ project with external libraries, but I don't manage to make it work. When I try to specify a certain external library file, it seems that ld.exe cannot find it; I tried relative path, absolute path, finding the file in the "open file" dialog, even renaming the file so that it starts with a lowercase L. I am 100% sure the file exists, yet ld.exe cannot find it. How can I make it see the files? If it needs a different syntax/keyword, how can I force that syntax/keyword in Eclipse settings?

c:/mingw/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lc:\gurobi900\win64\lib\gurobi90.lib

(Using Visual Studio it was possible to add these .lib files to the linker the way described here, I want to do the same.)

Rolf
  • 331
  • 4
  • 13
  • Would this help https://stackoverflow.com/a/17209507/1075282 ? Or this https://stackoverflow.com/questions/38584344/linking-a-lib-file-on-windows-7 ? – Renat Jan 21 '20 at 16:09
  • Are mingw libraries just linkable like that in visual studio? – darclander Jan 21 '20 at 16:14
  • @Renat This seems to work, at least I don't get an error message. But my file still doesn't compile, for some reason the compiler cannot find the definitions in the .lib file, so I'm not sure it can actually read the file. – Rolf Jan 21 '20 at 16:25
  • You probably need `mingw` binaries instead of Visual Studio binaries if your compiler is `mingw`. – drescherjm Jan 21 '20 at 17:45
  • @drescherjm I converted the binaries into a lib[filename].a file using [lib2a](https://code.google.com/archive/p/lib2a/), but now I again cannot make the linker accept the .a file, it just won't "find" it no matter how do I specify the path. – Rolf Jan 21 '20 at 17:57
  • The problem is you converted a `c++` .lib and not a `c` based `.lib`. My advice is to build the third party library with `mingw`. – drescherjm Jan 21 '20 at 17:58
  • @drescherjm Thanks for the reply! Unfortunately, I'm not really experienced in building things with minGW, and when I try to do it it cannot find some definitions even though they all are in the .cpp files - same error message as Eclipse throws when trying to link the binaries. Is there a particular way or order of files to compile? Or is there a basic makefile for building libraries like this? – Rolf Jan 21 '20 at 18:21

0 Answers0