我有佳能 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'
请帮忙