首页 > 解决方案 > Eclipse RegExp 控制台将错误解析为问题窗口

问题描述

需要 Eclipse 专家帮助!我已经建立了一个 makefile 项目来使用免费的 codewarrior 工具编译和链接 HCS12 代码。一切似乎都运行良好,但我能得到的唯一错误/警告/信息输出是控制台,没有任何内容从控制台扫描到“问题”窗口。我设置了一个正则表达式错误解析器(Window -> Preferences -> C/C++ -> Build -> Settings -> Error Parsers)来扫描控制台以获取适当的信息。如果我使用查找/替换并选中“正则表达式”来搜索控制台输出(单击输出和 F),我会发现警告和错误——它们永远不会进入问题选项卡。

我在(Project->Properties->C/C++ Build->Settings->ErrorParsers)中启用了错误解析器。

在某处我读到我需要在 C/C++ Makfile 设置中启用它——但我无法对包含名称“Makefile”的任何设置进行微调;我的项目设置错了吗??

关于如何将我解析的错误放入问题窗口的任何建议或想法?

Eclipse Luna,Windows 7 专业版。

标签: regexparsinginstallationeclipse-cdtmakefile

解决方案


It seems that the Regex parser for Eclipse (at least the older version I am currently using) assumes you start at the beginning of a line of text and end at the end of a line of text. My compiler errors were spanning multiple lines; I found a switch in the compiler which allowed it to output the errors in "microsoft format", which was then on a single line.

the new warning line looks like .\CODE\LIBCODE\CodeLibraries\Drivers\CI2C1.C(312): WARNING C1801: Implicit parameter declaration for 'CI2C1_OnMasterBlockSent'

regex that works is now [^"\n]\([^"(])((\d+)): WARNING C(\d+):([^\n]*)

of particular note is the [^"\n]*\ at the beginning of the regex expression, which matches all characters from the beginning of the line until the last \ is found--this is the piece I was missing. Eclipse Kepler is rather unforgiving about the regex it requires.

and we have File $1 (just the file name--eclipse adds the path mysteriously if the file is in a code directory of the project)

Line $2 (gathers the line number of the error)

Descrioption $4 ( I ignore WARNING and the warning number, and capture the description of the error to the end of the line)

I now have a useful and somewhat more modern IDE to work with ancient code which grew from the assembly code over many years and was never parsed out into libraries or restructured into modern levels of abstraction.


推荐阅读