0

I am trying to import C++ third party library:

1- FKAttend.h
2- FKAttend.lib
3- FKAttend.dll

In header file it uses implicit linking to call the functions

 #ifdef _FKATTEND
    #define FP_EXPORT __declspec(dllexport) APIENTRY
#else
    #define FP_EXPORT __declspec(dllimport)
#endif

My step in Visual Studio 2019 1- I have included path of header file 2- Linked FKAttend.lib by adding FKAttend.lib to "Additional Dependencies" and FKAttend.lib file path into "Additional Library Directories" And I get this error when I call a simple function from FKAttend.h enter image description here

I tried same thing in Eclipse, also I got an error enter image description here

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
  • Please, post the error logs as text (code), not images. – Suthiro Aug 31 '21 at 10:13
  • There is no 'implicit linking'. There are [_pragmas_](https://stackoverflow.com/questions/3484434/what-does-pragma-comment-mean) in headers to tell linker what to do. The question is a [duplicate](https://stackoverflow.com/questions/4445418/how-to-add-additional-libraries-to-visual-studio-project). – Suthiro Aug 31 '21 at 10:15
  • Does this answer your question? [How to add additional libraries to Visual Studio project?](https://stackoverflow.com/questions/4445418/how-to-add-additional-libraries-to-visual-studio-project) – Suthiro Aug 31 '21 at 10:16
  • Can you show the contents of FKAttend.h? – secuman Sep 01 '21 at 09:39
  • The compiler assumes this library was written in C++, note the mangled function name in the linker error message. Surely it was not, wrap the #include with `extern "C" { ... }` – Hans Passant Sep 01 '21 at 11:58

1 Answers1

0

According to your description of the problem, please check the following two points:

  1. Please check the path of the .lib file, it is best to use an absolute path to reduce the probability of error.

  2. I suggest you should check if the platform and configuration settings are consistent with the build time.

enter image description here

enter image description here

I suggest you could set Configuration and Platform in the property settings to ALL.

enter image description here

Jeaninez - MSFT
  • 3,210
  • 1
  • 5
  • 20
Yujian Yao - MSFT
  • 945
  • 1
  • 3
  • 9