문제

Hi I'm trying to test control a canon camera via usb in c++ (eventually I want to use it on labview). I'm trying to initialise the camera before I use any other functions, firstly I have the lib and dll files provided with the canon SDK but I don't think I've included them correctly since I get an unresolved external error

1>EDSDK.obj : error LNK2019: unresolved external symbol __imp__EdsInitializeSDK@0 referenced in function _main   

I'm pretty much new to c++ so I don't have the best idea of what I'm doing, would anyone have any suggestions on how I could get this initialization to work? Also on how to include the lib and dll files correctly? Below is the code I've written.

#include "EDSDK.h"
#include "EDSDKErrors.h"
#include "EDSDKTypes.h"
#include <stdio.h>

void main(int argc, char **argv)
{
EdsError err = EDS_ERR_OK;
EdsCameraRef camera = NULL;
EdsCameraListRef cameraList = NULL;
EdsUInt32 count = 0;
bool isSDKLoaded = false;

// Initialize SDK
err = EdsInitializeSDK(); // If camera is initialised, err = EDS_ERR_OK
if(err == EDS_ERR_OK)
{
isSDKLoaded = true; // isSDKLoaded is true if initialised
printf("SDK initialised");
}

printf("SDK not-initialised\n");

}

올바른 솔루션이 없습니다

다른 팁

You have to tell the linker to link your program with the library. How to tell the linker depends on the tool chain. You should refer to the documentation.

I had also a long time to figure this out and the following steps worked for me:

In VB, you must link to the folder with the header files and the folder with the lib file. To do so:

In the property page, under C/C++ --> General, add the path to the folder with headers in 'Additional included Directories' (select 'edit' in dropdown list). Under Linker --> Input, add in 'Additional Dependencies' the path tot the library folder (select 'edit' in dropdown list).

Put the dll files in C:/Windows folder.

The dll files should be put in the same file as the executable (normally "Debug" folder).

See also : How do I link a DLL to my project? error LNK2019: unresolved external symbol

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top