You have to study the compiler output and then extract the line number and the filename when the user clicks on the line with the error. Once you extract the filename, you would know which file to open or just activate if it's already open and once the file is open/active you just need to highlight that particular line number -- the one that you extracted. That's the way I do it.
SkyIDE supports 10 compilers and now I am adding support for Visual C++ Express, the 11th compiler. Each compiler produces different outputs so I did a lot of studying, inspecting their output and some of them are still buggy but I think I just squashed all the bugs. Beta 14 will have bug fixes for LCC-WIN32 one and the Free Pascal one (errors occured due to not enough research).
Some of the compiler outputs are really complicated. The one I found the hardest to work with is "almost everyone's favorite": GNU C++ -- nothing wrong with the compiler itself, it's just that the output it produces is a bit complicated but I got it going
It was the first compiler that SkyIDE supported.