Hi, I’m trying to build the ArduCAM USB Camera Shield C++ demo on Windows following Build_Windows.md, but the build fails in the Arducam_Opencv_Demo project with this error:
error C3861: ‘ArduCam_registerCtrls’: identifier not found
at src\Utils.cpp line 113.
I’m using Visual Studio 2022 on Windows 10. Has anyone run into this?
That error usually points to a stale or invalid build directory. Try removing the build folder entirely, recreating it, and re-running CMake configure/generate (refactor the project) before building again.
The guide I’m referring to is: ArduCAM_USB_Camera_Shield_Cpp_Demo/Build_Windows.md at main · ArduCAM/ArduCAM_USB_Camera_Shield_Cpp_Demo · GitHub
Also make sure you’re using the right config for the EK030 (108MP): ArduCAM_USB_Camera_Shield/Config/USB3.0_UC-593 Rev.C/MIPI/ArduCAM_108MP at master · ArduCAM/ArduCAM_USB_Camera_Shield · GitHub
If it still fails, paste the full build log.
I removed and recreated the build folder and re-ran CMake, but it still fails with the same C3861 error at src/Utils.cpp line 113.
Environment:
Windows: Microsoft Windows [Version 10.0.22621.2283]
Generator: Visual Studio 17 2022, x64 via -DCMAKE_GENERATOR_PLATFORM=x64
Compiler: MSVC 19.33.31630.0
MSBuild: 17.3.1+2badb37d1
Windows SDK: 10.0.19041.0 targeting 10.0.22621
OpenCV: 4.8.0 at D:/opencv/opencv/build/x64/vc16/lib
Project path: C:/Users/MyUser/source/repos/NEW/ArduCAM_USB_Camera_Shield_Cpp_Demo
Commands I ran:
cmake -DCMAKE_GENERATOR_PLATFORM=x64 …
cmake --build . --config Release
Build output:
error C3861: ‘ArduCam_registerCtrls’: identifier not found [Arducam_Opencv_Demo.vcxproj] - C:\Users\MyUser\source\repos\NEW\ArduCAM_USB_Camera_Shield_Cpp_Demo\src\Utils.cpp(113,3)
warning C4005: ‘ARDUCAM_API’: macro redefinition - arducam_config_parser.h(28,1) / ArduCamlib.h(8)
warning C4018: ‘<’: signed/unsigned mismatch - Arducam.cpp(74,22) and Utils.cpp(251,21)
warning C4244: ‘=’: conversion from ‘double’ to ‘int’, possible loss of data - Utils.cpp(236,29)
From your CMake output, the ArduCAM SDK is being extracted/installed into libs\libs\arducam. That nested libs folder is the problem — the directory layout is wrong, so Utils.cpp can’t find ArduCam_registerCtrls.
Go to ArduCAM_USB_Camera_Shield_Cpp_Demo/libs/ and rename the folder libs/arducam to just arducam (remove the extra libs prefix). Then recompile.
If it still fails after that, pack the entire project plus its dependencies into a ZIP/RAR and send me a cloud download link so I can reproduce it here.
Still failing after the rename. I packed the whole project into an archive (ArduCAM_USB_Camera_Shield_Cpp_Demo-main.zip) and uploaded it. I’ve sent you the download link privately.
Thanks, I got the archive. I’ve prepared a corrected arducam library directory for you. Check your private messages — download it and replace the existing arducam directory under libs with the corrected one, then rebuild.
I don’t have access to the file you sent. It’s asking me to request approval. Could you approve the download or reshare it?
I’ve re-checked and updated the sharing permissions on the corrected arducam directory link. Try the download again and let me know if it’s still blocked.
The camera builds and runs now, so the library fix worked. But the image quality is poor. Where do I change the camera settings? I have a sample photo but can’t attach it here.
Image tuning is done programmatically with setCtrl. See Arducam.cpp around line 46: ArduCAM_USB_Camera_Shield_Cpp_Demo/src/Arducam.cpp at main · ArduCAM/ArduCAM_USB_Camera_Shield_Cpp_Demo · GitHub
For example, camera->setCtrl(“setGainB”, value) would adjust the blue gain.
I found settings I liked using the ArduCAM USB Camera Shield UI and copied the function names and values into ArduCam_test.cpp, but the controls seem to have no effect. I placed the setCtrl calls after openCamera and before camera->start():
camera->setCtrl(“setFocus”, 1023);
camera->setCtrl(“setFramerate_deci”, 10);
camera->setCtrl(“setFramerate_1x”, 14);
camera->setCtrl(“setExposureTime_ms”, 5000);
camera->setCtrl(“setExposureTime_us”, 1000000);
camera->setCtrl(“setGain”, 1079);
camera->setCtrl(“setDigitalGainR”, 400);
camera->setCtrl(“setDigitalGainB”, 400);
camera->setCtrl(“setEnableGamma”, 1);
camera->setCtrl(“setGainR”, 211);
camera->setCtrl(“setGainB”, 215);
camera->start();
std::thread camera_display(display, camera, deviceID);
The controls need to be applied after the camera has started. Move all of those setCtrl(…) calls so they execute after camera->start(), not before it. The values you listed should then take effect.
I also tried setting the ‘def’ values in the config file’s control section, but those don’t take effect either. In the streaming demo I’m not sure where to add the ctrl values because there’s no start function. I put the ArduCam_setCtrl calls after ArduCam_setMode(cameraHandle, CONTINUOUS_MODE):
ArduCam_scan(pUsbIdxArray)
camera_initFromFile(config_file_name, cameraHandle, cameraCfg)
std::thread captureThread(captureImage_thread, cameraHandle)
std::thread readThread(readImage_thread, cameraHandle)
ArduCam_setMode(cameraHandle, CONTINUOUS_MODE)
ArduCam_setCtrl(cameraHandle, “setFocus”, 1023)
ArduCam_setCtrl(cameraHandle, “setFramerate_deci”, 10)
ArduCam_setCtrl(cameraHandle, “setFramerate_1x”, 14)
ArduCam_setCtrl(cameraHandle, “setExposureTime_ms”, 5000)
ArduCam_setCtrl(cameraHandle, “setExposureTime_us”, 1000000)
ArduCam_setCtrl(cameraHandle, “setGain”, 1079)
ArduCam_setCtrl(cameraHandle, “setDigitalGainR”, 400)
ArduCam_setCtrl(cameraHandle, “setDigitalGainB”, 400)
ArduCam_setCtrl(cameraHandle, “setEnableGamma”, 1)
ArduCam_setCtrl(cameraHandle, “setGainR”, 211)
ArduCam_setCtrl(cameraHandle, “setGainB”, 215)
The control section in the config file only generates the control sliders in the GUI — it does not set camera defaults. To set default values like the CPP demo does, you have to apply them programmatically after the program/camera has started.
Also, the streaming demo is no longer maintained, so I’d recommend switching to the CPP demo. In the CPP demo, put the setCtrl calls after camera->start().
In the CPP demo, most setCtrl calls work now, but 4 of them report ‘not modified’ (I have a screenshot), while the other functions work. Here’s my current code:
camera->setCtrl(“setFocus”, 581);
camera->setCtrl(“setFramerate_deci”, 5);
camera->setCtrl(“setFramerate_1x”, 5);
camera->setCtrl(“setExposureTime_ms”, 4);
camera->setCtrl(“setExposureTime_us”, 5963);
camera->setCtrl(“setGain”, 0);
camera->setCtrl(“setDigitalGainR”, 190);
camera->setCtrl(“setDigitalGainB”, 195);
camera->setCtrl(“setEnableGamma”, 1);
camera->setCtrl(“setGainR”, 100);
camera->setCtrl(“setGainB”, 100);
How do I control these 4?
Which four exactly are returning ‘not modified’? Can you paste the exact console output lines? Some controls depend on the sensor/current mode, so knowing the specific function names will help narrow it down.
Separate question about resolution. I want the highest quality/resolution output. The sales team gave me a 12000x9000 config file, but when I use it in the Visual Studio project the camera fails to start. The 4000x3000 config starts successfully. In the ArduCAM USB Camera Shield UI, the 12000x9000 config works and produces an image around 2.5MB, but in the VS project the 4000x3000 config only gives me about 250KB, which seems way too small for a 108MP camera. Is the config file wrong, or is quality adjusted somewhere else?
Let’s summarize where we are: the build issue is fixed, and the CPP demo works with setCtrl calls applied after camera->start(). For the four ‘not modified’ controls, I still need the exact function names and console output.
For the resolution issue: 4000x3000 starts in the VS project, while 12000x9000 only works in the UI. That suggests the difference is in how the VS project initializes/streams with that config rather than the config file necessarily being wrong. Can you paste the exact error or console output from the VS attempt with the 12000x9000 config? That will tell us where it’s failing to start.