using Visual Stuio as IDE for third party compiler: need help for error parsing

Roger Bäuerle 1 Reputation point
2021-04-06T16:36:55.52+00:00

Hello,

we also use Visual Studio (2017) for compiling our makefile driven project code with a third party compiler (Greenhills for embedded applications). For this purpose, we use the 'platform.targets' file. In Visual Studio. Triggering this file is done in the 'Solution Platform' listbox.

According to Microsoft documentation (https://learn.microsoft.com/en-us/dotnet/api/microsoft.build.tasks.exec?view=msbuild-16-netcore), this file contains the Exec class with the three properties Command, ConsoleToMsBuild and WorkingDirectory. The used code in platform.targets is:

 <Exec Command="$(SolutionDir)\..\mm.bat PLL02#$(Configuration) bin_comp 3 LIBYES 2 /F DIAGNO" ConsoleToMsBuild="true" WorkingDirectory="$(SolutionDir)\..\"/>  

 

mm.bat is the batch control with seven parameters for the Greenhills compiler.

In case of a compiler error, we now would like to activate a comfortable ErrorParser, which loads the corresponding source code file into the editor window by double-clicking on the erroneous line in the output window, and places the cursor automaticlly on the erroneous code line.

When using Eclipse as second IDE for our makefile project, this works very nicely via a regex control ('Regex Error Parser'). However, in Visual Studio this does not work or is a bit awkward: The source code file must be actively selected in the editor window. Then you can double click on the displayed error in the Error List (not in the output window) and the cursor is then automatically placed on the erroneous line in the source code.

How can this be done directly from the output window? The CustomErrorRegularExpression property is specified for the Exec class for such purposes (at least that's what I think it is in the from the Microsoft documentation), but it does not work with the RegEx used in Eclipse.

Does anyone have any advice here? Roughly speaking, is it at all possible to trigger an action from the Visual Studio output window by double-clicking (in the sense that the (in the sense that the clicked line is 'read' by the output window for further processing; the further processing should ultimately display the erroneous source code line).

Here you see pics:

Eclipse:
84888-ecl.png

Visual Studio:
84972-vs1.png
84973-vs2.png

Best Regards

Roger

Developer technologies Visual Studio Other
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Michael Taylor 60,161 Reputation points
    2021-04-06T17:03:04.71+00:00

    In answer to your last question about how to trigger an action in the Output window then that can be done. When you double click a line in the Output window the IDE looks to see if the line is of the form: <filename>(line). If it finds such a format then it will open the given filename and jump to the given line. AFAIK this is the extent, outside a VS extension, that you can trigger an action from the window. I don't believe it matters whether the file is actually part of the project or not, it simply opens the file (if it isn't open) and jumps to the line given.

    This is how code generators work. For example C++/C# support a line pragma that, when used in code, causes the compiler to use the given line/# in the pragma instead of the actual line a warning/error would have used. Code generators like T4 generate C# code with the line pragmas in them that point back to the T4 template lines. If a compiler error occurs in the generated code then rather than pointing to the generated code it points back to the T4 template. Double clicking that line in the output window causes the dev to jump to the template where the problem is and not the generated code that actually contains the error line.

    0 comments No comments

  2. Roger Bäuerle 1 Reputation point
    2021-04-06T17:38:16.907+00:00

    Hello @Michael Taylor , thx for your answer. It is good to know that the double-click on the output window can in principle be further processed according to the specified rule. However, this does not work for me because the output of the third-party compiler does not seem to follow this rule. The specified batch file does the same output as in the Visual Studio output window also in the same way in a command line window (cmd.exe).


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.