Page 1 of 1

How to Debug in Visual Studio

Posted: 07 Sep 2017, 07:25
by Langerz
I can compile both Release and Debug builds but how can I run OpenMW in MS VS's debug mode? I checked the vcproj file and debugging sends a custom command CMAKE and it runs but the working directory is incorrect because it cant find the settings-default.cfg file. How do I set it so CMAKE registers the working directory prior to launching the openmw.exe debug version?

Re: How to Debug in Visual Studio

Posted: 07 Sep 2017, 08:19
by PlutonicOverkill
I ran into the same problem here that was fixed by changing the Working Directory from $(ProjectDir) to $(OutDir) in each project you want to debug. Try changing that and it should hopefully fix your problem.

Re: How to Debug in Visual Studio

Posted: 07 Sep 2017, 12:28
by AnyOldName3
I have it set to $(TargetDir), and that works too. At one point I investigated to see if we could get the build script to set this by default, but there wasn't anything clear that could be changed with the CMake files. Maybe eventually I'll try and do it in bash instead, but that's probably going to add quite a bit of complexity to the prebuild script.

Re: How to Debug in Visual Studio

Posted: 08 Sep 2017, 06:04
by PlutonicOverkill
Looks like it has been added to CMake in a recent version (3.8). Of course, some people might be using an older version of CMake, but could we add a conditional so that this is only set if a recent CMake version is being used? It would be better than nothing.

Re: How to Debug in Visual Studio

Posted: 08 Sep 2017, 17:33
by AnyOldName3
I've created a pull request to resolve this: https://github.com/OpenMW/openmw/pull/1435