3

Is there a (free) text editor that automatically synchronizes method declarations so that if I update method definition in a .CPP then its declaration in the .H gets updated automatically (and vice versa)?

Better yet, present the class' source code in a single editor view and generate .H and .CPP from it automatically.

MS Visual Studio has some support for that, but its not free.

4
  • MS Visual Studio Express is free (beer-free rather than speech-free but I think that's what you meant). I don't know if the express version has that feature but it's probably worth checking out.
    – paxdiablo
    May 26, 2011 at 13:14
  • 2
    Where is that feature in Visual Studio? I've never seen it before, and neither have these folks. It is a component of Visual Assist X, as I understand, but that's an add-on to VS, not part of it. May 26, 2011 at 13:16
  • 2
    I prefer not having the header automatically updated: it keeps me in control of when dependencies change (a recompile could be triggeredm even if you hit undo after the fact); also it encourages being scrupulous about only including public interface in the header at all times. A good design goes a long ways, I suppose
    – sehe
    May 26, 2011 at 13:34
  • 1
    Such automatic features also will mess with you code intendations. But if you manage to find a utility that does that with minimal impact, I bet it's never going to be free. But then necessity is the mother of invention. Maybe try to create one yourself if you fail to find one? May 26, 2011 at 13:45

3 Answers 3

2

If you're editing a stable library then you do not want this, because you really care about when you change an interface -- since it probably means you're breaking compatibility with something else.

If you're in the rapid-prototyping stage, then why not put all your definitions in the header file, and worry about separating them into the implementation file later.

That said, I know of nothing that actually does what you want, so:

If you want to implement this, I'd suggest writing a third header&implementation file (that the compiler never sees), which you actually edit, and then adding a pre-compilation stage that automatically splits it into header and source. You'll probably want to annotate include directives to show where they need to be.

2
  • No, I want this for brand new projects, and I am willing to accept any special indentation/formatting quirks needed to support the automatic editing functionality.
    – rustyx
    Jun 7, 2011 at 13:38
  • Good point about the compatibility check. This is something that e.g. Java does not have, so there have to be tools like wiki.netbeans.org/SigTest
    – user7610
    Dec 17, 2016 at 23:21
2

Take a look at makeheaders. It does not provide parallel editing features, but instead generates headers from your source files.

2

KDevelop has some support for it. Not flawless, but it is pretty good. One of my projects is cross platform, and whenever I need to expand my code, I prefer KDevelop over Visual Studio.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.