Im trying to call an API from a header file LG101API.h. I linked it in Leds.cpp like this #include "LG101API.h". The project has a dll and lib LG101API.dll
LG101API.lib
. I linked the lib in linker > input and added the path to the linker>general>additional Library directories. Now I keep on getting the
LNK2019 unresolved external symbol "__declspec(dllimport) int __stdcall KC_LG101_OPENPORT(int,int)" (__imp_?KC_LG101_OPENPORT@@YGHHH@Z) referenced in function _main
Here is the header code
#ifdef LG101API_EXPORTS
#define LG101API_API __declspec(dllexport)
#else
#define LG101API_API __declspec(dllimport)
#endif
// This class is exported from the LG101API.dll
class LG101API_API CLG101API {
public:
CLG101API(void);
// TODO: add your methods here.
};
extern LG101API_API int nLG101API;
//////////////////////////////////////////////////////////////////////////
LG101API_API int _stdcall KC_LG101_OPENPORT(int iCom, int iPort);
LG101API_API int _stdcall KC_LG101_CLOSEPORT(void);
LG101API_API int _stdcall KC_LG101_SETLED(int iLed, int iTurnOn);
LG101API_API int _stdcall KC_LG101_READLED(int* iLEDst);
LG101API_API int _stdcall KC_LG101_READGUARD(int* iGUARDst);
LG101API_API int _stdcall KC_LG101_SETLEDMODE(int iGroup, int iOnTm, int iOffTm);
//////////////////////////////////////////////////////////////////////////
LG101API_API int _stdcall KC_LG101_RESET();
LG101API_API int _stdcall KC_LG101_CONTROLLED(int iLed, int iOnOff, int iOnTm, int iOffTm);
LG101API_API int _stdcall KC_LG101_SETTWINKLE(int* iLedArray, int iOnTm, int iOffTm);
LG101API_API int _stdcall KC_LG101_SETBOOT(int* iLedArray, int* iTwinkleLedArray, int iOnTm, int iOffTm);
LG101API_API int _stdcall KC_LG101_READLEDST(int* iLedArray, int* iTwinkleLedArray);
LG101API_API int _stdcall KC_LG101_GETVERSION(int* iVer);
this is how im calling it in main
KC_LG101_OPENPORT(1, 9600);
KC_LG101_SETLED(1, 1);