I was running a Python program that used the camera and closed the program that I had created but left Python open. When testing a C++ program with the camera I was getting this error even though I had the Python program that I created closed.
After I closed Python itself then my camera was able to work in C++