2

Does anybody know whether it's possible to get the error-row of a file being compiled when the error occurs in an include file?

For example, I'm compiling a file, say abc.p, that uses def.i all over the place. At some point, I make a change to abc.p that causes a compile error in one of the includes, so the message says that the error occurred at line 123 of def.i, but I want to know at which line in abc.p that is. In other words, the line number where the offending include file is used.

Even though "Compiler:Get-File-Name(n)" returns def.i and "Compiler:File-Name" returns abc.p, both "Compiler:Get-Row(n)" as well as "Compiler:Error-Row" returns the line number in def.i.

Any ideas?

RobertT
  • 1,213
  • 10
  • 12
  • Post a code sample of abc.p and def.i and it would be easier to answer your question – briddums Jun 15 '12 at 18:47
  • Listing an example of the code will just make it less clear. We have a ridiculous procedure that's grown like a cancer over years, tens of thousands of lines containing hundreds of occurrences of a certain include file. It has hundreds of internal procedures and functions and somewhere somebody used one of the includes incorrectly. But instead of the compile error saying "Line 1872362 of cancer.p caused an error" it says "Line 3 of tumour.i caused an error". Then we have to manually dig around to find which of the hundreds of occurrences is at fault, and we don't like doing things manually. – RobertT Jun 16 '12 at 09:33

2 Answers2

2

My guess would be to save the compiler listing or debug file and look at that.

Beyond that, I don't think there's a way to do it now - you need to submit an enhancement request to get this functionality.

Tim Kuehn
  • 3,201
  • 1
  • 17
  • 23
  • Saving the listing and examining the result manually is what we are currently doing. What I'm looking for is a programmatic way of getting the information from the Compiler so we can make the error messages more useful. But I believe that you have answered correctly - there doesn't seem to be a way to do it now. – RobertT Jun 16 '12 at 09:03
  • It might be possible to catch the compiler error when it gets thrown, parse that to get the line #, then compile the file to a debug listing and find the corresponding error context. – Tim Kuehn Jun 18 '12 at 13:12
0

My way of tracking this kind of error is with

compile source.p preprocess source.pp.

open source.pp in the procedure editor and check syntax. This gives you the error location in the expanded source. Once you have found that locate code that is not part of the include and search for that code in the original source.

carl verbiest
  • 1,113
  • 1
  • 15
  • 30