im currently trying to use the Canon SDK in C++. It's indeed the first time I use a SDK and im a begginer in C++.
The problem is that when i try to initialize the SDK with the EdsInitializeSDK()
function it instantly crash, here is the errors messages :
Exception thrown at 0x00007FFA34E0121C (EDSDK.dll) in CameraTest.exe: 0xC0000005: Access violation reading location 0x00000000B44D4740.
Unhandled exception at 0x00007FFA34E0121C (EDSDK.dll) in CameraTest.exe: 0xC0000005: Access violation reading location 0x00000000B44D4740.
Heres the entire code here :
#include "stdafx.h"
#include "iostream"
#include "EDSDK.h"
#include "EDSDKTypes.h"
#include "CameraModel.h"
#include "CameraModelLegacy.h"
#include "CameraController.h"
#include "CameraEventListener.h"
using namespace std;
int main(void)
{
EdsError err = EDS_ERR_OK;
EdsCameraListRef cameraList = NULL;
EdsUInt32 count = 0;
EdsCameraRef camera = nullptr;
bool isSDKLoaded = false;
err = EdsInitializeSDK();
system("pause");
if (err == EDS_ERR_OK) {
cout << "SDK INITIALISED" << endl;
} else {
cout << "SDK INITIALISATION FAILED WAIT FOR EXIT" << endl;
system("pause");
exit(84);
}
cout << err << endl;
err = EdsGetCameraList(&cameraList);
cout << err << endl;
if (err == EDS_ERR_OK) {
cout << "Camera List Ok" << endl;
err = EdsGetChildCount(cameraList, &count);
cout << "Count : " << count << endl;
if (count == 0) {
err = EDS_ERR_DEVICE_NOT_FOUND;
}
}
else {
cout << "No Camera List" << endl;
}
if (err == EDS_ERR_OK) {
cout << "It worked" << endl;
err = EdsGetChildAtIndex(cameraList, 0, &camera);
} else {
cout << "It didnt worked" << endl;
}
system("pause");
}
If i remove the EDSInitializeSDK function, it don't crash. Do you have an idea about whats the problem ? Thanks.
Ok, so the answer is quite simple. When i connect my camera, a software named "EOS Utility 3" shows up. Its the problem, when I close it (and makes sure its realy close and not just reducted), it works. Thanks for your help. (I was using Canon EDSDK version 3.6.1 with a Canon EOS 1300D)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.