this is my first question here so I'll try to be clear and explain everything I know.
I'm newbie with C++ and I need to create my own dll that use functions from third party dll's, so I want to link one .dll to my proyect and it seems to not work. After having my .dll I have to use it in a C# project using pinvoke.
I've searched everywhere and tried some things but without luck, I have the .h, .lib and .dll and for the moment I have this:
In project properties:
-Set the .lib path in Conf Properties-->Linker-->General-->Additional Library Directory
-Add the .lib name on Conf Properties-->Linker-->Input-->Additional Dependencies
-Set the .dll path in Conf Properties-->C/C++-->General-->Additional inclusion directories
In the project .cpp file
#pragma comment(lib, "HCNetSDK.lib")
#pragma comment(lib, "HCCore.lib")
#include "HCNetSDK.h"
This is the error message:
Error LNK2019 símbolo externo __imp_NET_DVR_Init sin resolver al que se hace referencia en la función
I made a small funtion that throws the exception to show up the problem:
.cpp file
#include <stdio.h>
#include "pch.h"
#include <iostream>
#include <string>
#include "Windows.h"
#include "Pruebahikvi.h"
#pragma comment(lib, "HCNetSDK.lib")
#pragma comment(lib, "HCCore.lib")
#include "HCNetSDK.h"
#include <comdef.h>
bool test() {
bool res = false;
try {
//function from HCNetSDK.h
NET_DVR_Init();
res = true;
}
catch (int ex) {
}
return res;
}
.h file
extern "C" __declspec(dllexport) bool test();
AFAIK linking a library dont have to be that hard, hope you guys can help me.