Search code examples
c++visual-studio-2010visual-studiodllvisual-studio-debugging

Error Message when trying to debug dll (C++) with visual studio 2010


I use to write dll project under visual studio 2010 for excel. In order to debug it, I always did: right clic on the project -> debug -> start new instance, and it used to walk.

For to days now, it doesn't work anymore. I got the message : "Unable to start program : '...\myDll.dll'."

The dll actually works normally, and I just want to check some results.

I don't know if an update could be the reason.

Has anybody encountered such a problem?

Regards


Solution

  • The error message would seem to indicate that the debugger is attempting to start a new process using your DLL as the host executable.

    That cannot work. In order to debug your DLL, there needs to be a process that hosts the DLL. The DLL cannot stand alone. So, you need to specify in the debugger options that you want Excel to be the host executable.

    In Visual Studio the setting is under Project | Properties | Configuration Properties | Debugging. You need to set the Command value to the executable that you wish to host your DLL.