How to Debug in Visual Studio

Support for running, installing or compiling OpenMW

Before you submit a bug report for the first time, please read: Bug reporting guidelines
Post Reply
Langerz
Posts: 1
Joined: 07 Sep 2017, 07:20

How to Debug in Visual Studio

Post 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?
PlutonicOverkill
Posts: 20
Joined: 25 Apr 2017, 08:54
Location: New Zealand

Re: How to Debug in Visual Studio

Post 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.
User avatar
AnyOldName3
Posts: 2668
Joined: 26 Nov 2015, 03:25

Re: How to Debug in Visual Studio

Post 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.
PlutonicOverkill
Posts: 20
Joined: 25 Apr 2017, 08:54
Location: New Zealand

Re: How to Debug in Visual Studio

Post 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.
User avatar
AnyOldName3
Posts: 2668
Joined: 26 Nov 2015, 03:25

Re: How to Debug in Visual Studio

Post by AnyOldName3 »

I've created a pull request to resolve this: https://github.com/OpenMW/openmw/pull/1435
Post Reply