0

I’m trying to use an external .dll for a camera in my c++ project. I use Visual Studio 2010. I have 3 files: The uEye.h file in /include of my project folder, which I included under Properties…C/C++…additional_include_directories and via #include "include/uEye.h".

Then the uEye_api_64.lib in the /lib folder of my project. I added the path under Properties…Linker…General…Additional_Library_Directories and added uEye_api_64.lib under Properties…Linker…Input…Additional_Dependencies.

And finally the uEye_api_64.dll, which I put to the .cpp files in my project folder. Now I’m trying to use the functions provided by the DLL, for Example is_ExitCamera(), but upon building I get the Linker Error

LNK2019: unresolved external symbol __imp__is_ExitCamera referenced in function …

I have searched numerous forum posts but can’t find out what I did wrong.

Source code:

#include "stdafx.h"
#include "include/uEye.h"
#include "MeasurementAgents_CameraAbstraction.h"
#include <iostream>

UINT nDeviceID = 1;
HIDS hCAM = 0;

JNIEXPORT jboolean JNICALL Java_MeasurementAgents_CameraAbstraction_CamDisconnect
  (JNIEnv *, jclass){
       int nRet = is_ExitCamera(hCAM);
       if(nRet==IS_SUCCESS){
             return true;
       }else{
             std::cout << nRet;
             return false;
       }
}
manuell
  • 7,528
  • 5
  • 31
  • 58
Mudkip
  • 373
  • 6
  • 27
  • it is possible that library and your project built with different Runtime Library Settings (Project Options -, C/C++ -> Code Generation -. Runtime Library). The rule here is to use the same runtime library for all your project parts. – vard May 05 '14 at 14:18
  • Where is your third-party dll placed? – vard May 05 '14 at 14:22
  • @vard, Thanks for your fast response, I tried all 4 available settings but all gave the same error (multi-threaded even more). – Mudkip May 05 '14 at 14:34
  • @vard, the uEye_api_64.dll is located in the project folder and in the windows/system32 folder. – Mudkip May 05 '14 at 14:37
  • fact that you got error on linking step means that .lib isn't appropriate. Maybe you should set some preprocessor macro for your project, look in your 3rd party library documentaion. – vard May 05 '14 at 14:50
  • 1
    have you defined macro _IDS_EXPORT or _FALC_EXPORT? – vard May 05 '14 at 14:55
  • I’m not sure what you mean by that, I can’t find anything in the documentation or the example proramms. But _IDS_EXPORT and _FALC_EXPORT are defined in the uEye.h file which I included: #if defined (_MSC_VER) || defined (__BORLANDC__) || defined (_WIN32_WCE) #if defined (_PURE_C) && !defined (_IDS_EXPORT) && !defined (_FALC_EXPORT) #define IDSEXP extern __declspec(dllimport) INT __cdecl #define IDSEXPUL extern __declspec(dllimport) ULONG __cdecl #elif defined (__STDC__) && !defined (_IDS_EXPORT) && !defined (_FALC_EXPORT) – Mudkip May 07 '14 at 12:00
  • #define IDSEXP extern __declspec(dllimport) INT __cdecl #define IDSEXPUL extern __declspec(dllimport) ULONG __cdecl #elif !defined (_IDS_EXPORT) && !defined (_FALC_EXPORT) // using the DLL, not creating one #define IDSEXP extern "C" __declspec(dllimport) INT __cdecl #define IDSEXPUL extern "C" __declspec(dllimport) ULONG __cdecl #elif defined (_IDS_VBSTD) || defined (_FALC_VBSTD) // for creating stdcall dll #define IDSEXP extern __declspec(dllexport) INT __stdcall #define IDSEXPUL extern __declspec(dllexport) ULONG __stdcall – Mudkip May 07 '14 at 12:01
  • #else // for creating cdecl dll #define IDSEXP extern __declspec(dllexport) INT __cdecl #define IDSEXPUL extern __declspec(dllexport) ULONG __cdecl #endif #elif !defined (_IDS_EXPORT) && !defined (_FALC_EXPORT) // using the DLL, not creating one #define IDSEXP extern __declspec(dllimport) INT __cdecl #define IDSEXPUL extern __declspec(dllimport) ULONG __cdecl #endif – Mudkip May 07 '14 at 12:02

0 Answers0