This problem happened when I tried to build OpenImageIO on Windows 7 64 bit + Visual Studio 2015. There are some problems in the compiled binary of the OpenImageIO library, so I want to debug some source codes of it to locate the problem. But the breakpoint does not hit.
Specifically, the application code I used to debug OpenImageIO is Tools\iconvert
and the code crashes when I execute to the line:
ImageInput *in = ImageInput::open (in_filename.c_str());
The implementation of ImageInput::open
is contained in imageinput.cpp in project OpenImageIO of the solution. I compiled both projects under Debug configuration which enables debugging information generation. But when I set a breakpoint at the definition of ImageInput::open
at line 86, the breakpoint is white indicating that it is invalid, and the prompt says the breakpoint is not currently be hit, as the screenshot below shows:
I checked other places, like the reference properties which indicates clearly that the iconvert is linking to the Debug version of the OpenImageIO library:
Also, the Debug configuration is set correctly (in my understanding):
So, why the breakpoint cannot be hit? How should I fix this issue? If you need more information to troubleshoot please let me know. Thanks a lot.
About one year ago, I encountered a similar problem when I tried to use PyCharm (running on Windows) to remotely debug a python script executed inside Autodesk Maya (running on Linux). Later I managed to figure out it was due to the path of Linux -- it is an old python script in one of the search paths in linux that is running instead of the script in the source folder I assumed to be running. So I think the problem here should be the same.
OpenImageIO depends on a lot of 3rd party libraries in dll form, so yesterday, I put all of them into C:\Windows\system32 to ease searching. But since there are some problems, today I changed the settings of CMake and rebuild, and I changed my mind during the rebuild by putting newly compiled dlls to OIIO's bin folder (I don't want to mess up the system directory). To make the change take effect, I added this folder into PATH and deleted old problematic dlls from system32. But I missed one -- OpenImageIO.dll which is responsible for ImageInput::open! I trusted my memory too much; I should have sorted files by create date.
Of course I didn't know of it at first, so according to my previous experience, first I checked if the dll loaded is the one I just built. This was done by menu DEBUG->Windows->Modules in VS2015. Aha, that windows clearly shows it is the OpenImageIO.dll in system32 that is loaded, which reminded me of what was happening. So I deleted (with shift) that old dll and everything is working as expected now -- I finally successfully build OpenImageIO using VS2015 on Windows 7 64 bit from source from scratch, including all 3rd party libraries.