Hi,

I need to link a library you can download from producer's site (http://www.dahuasecurity.com/download_3.html) to my c++ project. The library is named General_NetSDK_Eng_Windows64_IS_V3.40.2.R.130321.7z. I tried to:

  • Linker->Input : added to addidiontal dependencies lines:

    dhnetsdk.lib
    dhconfigsdk.lib

  • Linked->General : added to additional library directories a "D:\dahua\" directory which includes files dhnetsdk.lib, dhnetsdk.dll, dhnetsdk.h and dhconfigsdk.lib, dhconfigsdk.dll

  • C/C++->General : added to additional include directories a "D:\dahua\" directory

I included files by directive #include : dhnetsdk.h and dhconfigsdk.h. I also copied all library files (.lib, .dll, .h) to my application source code direcotry and debug directory.

Unfortunately I still get errors LNK2019 and LNK1120. What am I doing wrong?

You might have that problem if the library was built a C code and your program is attempting to call it's functions as C++ code. If that is the case then you need to tell the compiler that the library is C and not C++.

#ifdef __cplusplus
extern "C" {
#endif
#include "dhnetsdk.h"
#ifdef __cplusplus
}
#endif

Your solution doesn't work, still LNK2019 and LNK1120

What compiler are you using? Are you building it as Win64?

I forgot to write here. I solved this problem, you are right - it was problem with architecture. I had to build as Win64. I worked it out myself, but anyway thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.