1

Canon EOS D600 カメラを持っています。C++ を使用して写真を撮る必要があります。ドキュメンテーションは私を助けませんでした。写真を撮るサンプルコードはありますか?これは役に立ちません:

#include <windows.h>
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <EDSDK.h>
#include <EDSDKTypes.h>
#include <EDSDKErrors.h>

using namespace std;

EdsError getFirstCamera(EdsCameraRef *camera);
int main(){
    EdsError err=EDS_ERR_OK;
    EdsCameraRef camera=NULL;
    bool isSDKloaded=false;
    err=EdsInitializeSDK();
    if(err==EDS_ERR_OK) isSDKloaded=true;
    if(err==EDS_ERR_OK) err=getFirstCamera(&camera);
    EdsOpenSession(camera);
    EdsInt32 saveTarget = kEdsSaveTo_Host;
    err = EdsSetPropertyData( camera, kEdsPropID_SaveTo, 0, 4, &saveTarget );

    EdsCapacity newCapacity = {0x7FFFFFFF, 0x1000, 1};
    err = EdsSetCapacity(camera, newCapacity);


    const char* ch_dest = "C:\\photo\\Img.jpg";
    EdsCreateFileStream( ch_dest ,kEdsFileCreateDisposition_CreateAlways,kEdsAccess_ReadWrite,0);

    EdsSendCommand(camera, kEdsCameraCommand_TakePicture, 0);
    EdsCloseSession(camera);
    EdsTerminateSDK();
    return 0;
}

EdsError getFirstCamera(EdsCameraRef *camera)
{
EdsError err=EDS_ERR_OK;
EdsCameraListRef cameraList=NULL;
EdsUInt32 count=0;
// Get camera list
err = EdsGetCameraList(&cameraList);
// Get number of cameras
if(err == EDS_ERR_OK)
{
    err = EdsGetChildCount(cameraList, &count);
    if(count == 0)
    {
        err = EDS_ERR_DEVICE_NOT_FOUND;
    }
}
// Get first camera retrieved
if(err == EDS_ERR_OK)
{
    err = EdsGetChildAtIndex(cameraList , 0 , camera);
}
// Release camera list
if(cameraList != NULL)
{EdsRelease(cameraList);
cameraList = NULL;
}
return err;
}

#include <windows.h>
#include <iostream>
#include <conio.h>
#include <stdio.h>
#include <EDSDK.h>
#include <EDSDKTypes.h>
#include <EDSDKErrors.h>

using namespace std;

EdsError getFirstCamera(EdsCameraRef *camera);
int main(){
    EdsError err=EDS_ERR_OK;
    EdsCameraRef camera=NULL;
    bool isSDKloaded=false;
    err=EdsInitializeSDK();
    if(err==EDS_ERR_OK) isSDKloaded=true;
    if(err==EDS_ERR_OK) err=getFirstCamera(&camera);
    EdsOpenSession(camera);
    EdsInt32 saveTarget = kEdsSaveTo_Host;
    err = EdsSetPropertyData( camera, kEdsPropID_SaveTo, 0, 4, &saveTarget );

    EdsCapacity newCapacity = {0x7FFFFFFF, 0x1000, 1};
    err = EdsSetCapacity(camera, newCapacity);


    const char* ch_dest = "C:\\photo\\Img.jpg";
    EdsCreateFileStream( ch_dest ,kEdsFileCreateDisposition_CreateAlways,kEdsAccess_ReadWrite,0);

    EdsSendCommand(camera, kEdsCameraCommand_TakePicture, 0);
    EdsCloseSession(camera);
    EdsTerminateSDK();
    return 0;
}

EdsError getFirstCamera(EdsCameraRef *camera)
{
EdsError err=EDS_ERR_OK;
EdsCameraListRef cameraList=NULL;
EdsUInt32 count=0;
// Get camera list
err = EdsGetCameraList(&cameraList);
// Get number of cameras
if(err == EDS_ERR_OK)
{
    err = EdsGetChildCount(cameraList, &count);
    if(count == 0)
    {
        err = EDS_ERR_DEVICE_NOT_FOUND;
    }
}
// Get first camera retrieved
if(err == EDS_ERR_OK)
{
    err = EdsGetChildAtIndex(cameraList , 0 , camera);
}
// Release camera list
if(cameraList != NULL)
{EdsRelease(cameraList);
cameraList = NULL;
}
return err;
}

エラーが発生しました: [リンカ エラー] ` imp _EdsInitializeSDK@0'への未定義の参照

助けてください

4

1 に答える 1