Can a post-build step take me to a specific line of code?
-
18-09-2019 - |
Question
I just wrote a little program which will be executed as a post-build step when I compile certain projects.
This program returns 0 for success, or some number for failure. In case of failure, Visual Studio then correctly outputs: "The command [...] exited with code n."
However, a single number is not always helpful. In my case, I actually want the error to point to a specific place in the source code. Is it possible to output a filename and line number in such a way that Visual Studio will actually let me just double-click on the error and get there instantly?
Solution
If the program you're running is a console application, I think its output will appear in the output pane. If the output is of the form
D:\dev\project\Code\MyClasscpp(68) : something terrible happened
then you can double-click on the line and the editor will open on the indicated line.
Regards,
Sebastiaan