0

I have a third party C library, both in static format (.lib) and in dynamic format (.dll) with its own import library (.lib). It is MKL (Intel Math Kernel Library). I am working with cygiwn 64 on Windows 7.

In brief, I am trying to get a compiler born to work in POSIX world to talk to a lib compiled in Windows world, assuming that is vene possible.

I want to link that library as part of a C++ executable I am compiling with g++ in cygwin and I am trying to link with the DLL using the import library.

My command line, where I omit the file paths for simplicity, results in a undefined reference error.

$ g++ main.obj mkl_intel_lp64_dll.lib mkl_sequential_dll.lib mkl_core_dll.lib -o paper.exe 
mkl_intel_lp64_dll.lib: blah, blah, blah: undefined reference to `__GSHandlerCheck'
... and many other similar errors

Anybody knows if it is possible, and, if yes, how to do it?

Thanks

Fabio
  • 2,105
  • 16
  • 26
  • Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – Mike Kinghan Jul 02 '17 at 19:29
  • @Mark, I do not think this is a duplicate. I am trying to get a compiler born to work in a POSIX world to accept a lib written in Windows world, which I am not even sure it is possible. I have not found anything conclusive on this topic. – Fabio Jul 03 '17 at 13:50

1 Answers1

1

Try rearranging the arguments to g++ so that main.obj precedes the libraries it references.

varro
  • 2,382
  • 2
  • 16
  • 24
  • If you use g++, how is it that you have main.obj? True, this may not matter. – tim18 Jul 03 '17 at 00:22
  • @varro, thanks, that fixes the first problem, but now there are many other symbols not found, e.g. __GSHandlerCheck. Tried to add libcmt, but it does nto help. – Fabio Jul 03 '17 at 13:47
  • @tim18, it is just the name I give to the object file in the Makefile. I could use MingW, but the version of gcc they ship is pretty old. I need 6 or later. – Fabio Jul 03 '17 at 13:47
  • @varro, I had to edit the question following your suggestion, sorry for that. – Fabio Jul 03 '17 at 13:58