C++ Builder XE4 - autocompletion and syntax errors highlighting - c++

I am new to C++ Builder. I am trying out the XE4 version, but it doesn't seem to have autocompletion for include or checking and underlining a bad syntax like for example VS does. So I can put any rubbish and the editor doesn't indicate in any way that you made a mistake in your code. And as for auto completing include: when including headers it doesn't indicate anything if the headers exists. Does any one knows if these 2 features should work in C++ Builder XE4 and you just need to switch them on somewhere or they don't exist in this IDE ?
Thanks

I haven't used C++ Builder XE4 ... but on earlier versions, you could go into Tools > Options > Editor Options > Code Insight.
Q: Does that option exist in XE4? Does it help?
ALSO: http://docwiki.embarcadero.com/RADStudio/XE4/en/Code_Completion

I have the same problems for years now. It's only my personal opinion, but I think this kind of things are broken in C++Builder. The main IDE / programming language is Delphi / Object Pascal. They work and write primary with this one and make all kind of wrappers, etc. for C++ afterwards. In Delphi everything works normally. In C++ autocomplation DOES work, but seldom. Sometimes it pops up and sometimes not. I never managed to get syntax checking to work in realtime. Only after compilation the checking starts... sometimes. There are other things which don't work too, like the Refactoring feature which I use (in Delphi) to find and add missing libraries/headers to the "uses" list. This worked partly in previous C++Builder XE versions but doesn't work at all now. Also, all this features seems to be much slower in C++Builder.
That's sad. I liked the solid functionality in Borland's products, like in C++Builder 6. The documentation system (help) worked there wonderfully too. In Delphi / C++Builder it is slow and incomplete, because it is made with one of the worst documentation systems at all: Microsoft Document Explorer. :-(

Related

Lightweight alternatives to CDT for C++ editing in eclipse

For a few years now, I've been using Eclipse as my all-purpose file editor, regardless of the language I use (which mainly includes C++, Matlab and python, with some XML thrown in for fun).
However, I recently got a new machine with more a recent Eclipse, and the wonderful Colorer plugin, which I previously used, crashes (Which is a separate issue that's apparently specific to my setup - I'll try debug it, but in the meantime I have work to do)
So I've switched to CDT for C++ instead, and I'm having serious performance issues with the editor, especially when copy-pasting or undoing stuff. I understand why CDT is so heavy, but I don't want a full C++ IDE - just something that does decent syntax highlighting.
Are there any lightweight syntax highlighting alternatives to CDT (or Colorer) that do a decent job at C++, without the needless (for me) layer of code completion and all that jazz?
Or, alternatively, any ideas of things I can turn off to turn CDT into a lightning-fast bare-bones editor (I've already turned off the spell-checker and the indexer)
Edited to say that I'm not looking for a replacement editor for Eclipse, except maybe as a short-time fix. If this problem turns out to be unsolvable and I have to learn/configure something new, I'm going to switch to emacs (for all kinds of non-religious reason: it's pretty much standard everywhere, my colleagues already use it, and the person in charge of our standard development setup supports it, so it's really the most reasonable replacement for me) But really, I'd prefer a fix to my poor Eclipse.
I've finally figured out a work-around to my performance issue.
There is a "scalability" mode in CDT that kicks in when your file is above a certain number of lines (under Preferences-C/C++-Editor-Scalability). By changing the default size to 1, I can disabled the "editor live parsing" that seems to be causing the problem, and get a significant performance boost.
Jheez if you are using C++ then Netbeans handles Autocomplete for C++ the best -- short of visual studio.
I'm not sure if this will be of help for you, because I don't know your OS and you already found a "solution" for your issue, but a good lightweight, fast, and feature rich IDE for C++ under Linux is Anjuta
Maybe be usefull for anyone else

New to C++: should I use Visual Studio? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 4 years ago.
Improve this question
I'm about to start work on my first C++ project. I've done lots of C# and VB (VB6 and VB.NET), plus Java and a few other things over the past 10 years or so, just never had a requirement for C++ until now.
I plan to use Visual Studio 2008, but I'm interested to find out from experienced C++ programmers whether Visual Studio is a good IDE for a C++ newbie.
Will VS in any way make it harder for me to learn to program C++ correctly?
Will VS encourage any bad habits?
Are there any pitfalls I should look out for?
First off, VS 2008 is quite powerful and probably one of the best IDEs for C++ programming (at least with a supporting plugin such as Visual Assist X).
Beware, however, that C++ is a hard language to get right for the compilers and that the default warning level is quite lenient to boot. So it will tolerate bad/wrong code quite often. It is always advisable to check the code on other compilers as well – at the very least in g++ with high warning level in strict mode.
Also setting the warning level higher in Visual Studio is encouraged.
Visual Studio is an excellent IDE for C++. If you know it from C#, it will be comfortably familiar.
There is something to be said for starting to learn a language like C++ by not using an IDE at all, but by building from the command line. This will impress on you the various phases of the c++ compilation and linking process, and will serve you in good stead if you ever need real cross-platform portability.
VS 2008 is fine for developing C++. Like someone else said I would purchase Visual Assist X simply because it gives you Intellisense on steroids and a better code outliner. Also the MSDN docs you get with VS are excellent quality and include a full description of the C++ language and standard library. On Windows you would be mad to use anything else.
Use Visual Studio, especially if you already know it through C#. I agree with the others that you should invest in Visual Assist though.
You better off with code-editor + build tools
as an IDE, VS is pretty bad (subjective). There are a lot of alternatives (more lightweight, for sure)
By build tools I mean not only compiler but also some kind of make/jam etc
This way you'll be ready for real cross-platform development (first) and as a bonus you'll get the possibility for much quicker and comfortable builds for "not small" projects -- one command builds everything. And while you can get the same in VS (really?) it will be faster. Plus you can have project structure the way YOU want 8)
As for reference, for my pet-project i use source insight + kjam + msvc compiler
I remember a few years ago having some troubles with VS. Actually the problem was with the C++ compiler, because they didn't implemented some features of the language, or at least they didn't implemented in a standard way.
We switched to Eclipse CDT because it was relatively easy to use other compilers, supported custom makefiles, and multiple targets.
But if you plan to develop for Win32, VS it's probably the safest choice.
I'm doing something similar; I've done a lot of Java programming and started learning C++ not too long ago. When I am starting to learn a new language, I like to work through the various bits of syntax differences by writing smaller programs. As great as Visual Studio is for larger projects, I think it tends to add a lot of bulk for that kind of practice. I'm with Konrad on the command line idea - great place to start. I am also using Dev-C++ for the smaller projects. It's a nice, compact little gcc IDE that is only about 60MB total footprint on the hard drive, and it compiles to windows executables without any problem. Good luck in your endeavors!
Yes, use Visual Studio, it's an IDE you already know, so it has the lowest learning curve in terms of tooling. Since you've never done any C++ before, please use the IDE, not a console window to learn. The one thing you will miss is the .NET framework. You can use Managed C++ with VS, but if you plan on using pure C++, with no managed code at all, it's going to be scary at first.
One thing I've always noticed about C++ is that if you expect all the same tools you had with C# to be there for C++ when you start, you might be disappointed. VS is a great IDE, and it's had C++ support long before .NET came around, so trust it, enjoy it, and remember, nothing is perfect.
I asked a similar question here except using C on Visual Studio. Although I personally couldn't imagine doing C# without VS, I find using VS for C an exercise in masochism. I know this isn't exactly the same as what you're asking, but if you find that it is a similar experience in C++, know that it's not just you.
Using VS allows you to not having to get under the hood and understand how the chain of buildtools work. Use VS to automate what you know how to do manually and make sure you understand what happens behind the scenes. In the world of C++ you are more expected to understand the build chain than in high level languages like C# or VB.
If you're using the VC project system, you should be fine. If, however, you are using a makefile-based project, it's extremely important that you tell the IDE about your include paths, preprocessor macros, etc, so that intellisense will work correctly.
Some people form a bad impression of Visual C++'s code browsing capabilities because they are used to C# where there's no configuration required.
Another thing to be aware of: occasionally, I have found that intellisense stops working well in a project where I have worked for a few days or weeks. If your solution is called foo.sln, deleting the foo.ncb file will cause the IDE to reparse your code, and intellisense will start working again.
Finally, I've heard that VS 2010 will be a major improvement to the C++ IDE experience for the first time in years.
http://blogs.msdn.com/somasegar/archive/2008/11/21/c-enhancements-in-vs-2010.aspx
Yes, use visual studio, but be aware that applications that you build with it wont run on some computers unless they have the visual studio runtime redist installed. If you find your app wont work on other machines, go download it.

Why is Visual C++ lacking refactor functionality?

When programming in C++ in Visual Studio 2008, why is there no functionality like that seen in the refactor menu when using C#?
I use Rename constantly and you really miss it when it's not there. I'm sure you can get plugins that offer this, but why isn't it integrated in to the IDE when using C++? Is this due to some gotcha in the way that C++ must be parsed?
The syntax and semantics of C++ make it incredibly difficult to correctly implement refactoring functionality. It's possible to implement something relatively simple to cover 90% of the cases, but in the remaining 10% of cases that simple solution will horribly break your code by changing things you never wanted to change.
Read http://yosefk.com/c++fqa/defective.html#defect-8 for a brief discussion of the difficulties that any refactoring code in C++ has to deal with.
Microsoft has evidently decided to punt on this particular feature for C++, leaving it up to third-party developers to do what they can.
I'm not sure why it is like this, but third-party tools exist that help. For example, right now I'm evaluating Visual Assist X (by Whole Tomato). We're also using Visual Studio 2005.
devexpress provides Add-in Refactor! for C++ for VS2005 and VS2008.
Don't feel hard-done-by, it isn't available in VB.Net either :)
C++ is a HARD language to parse compared with C# (VB too unless you've "Option Explicit" and "Option Strict" switched on, it's difficult to tell exactly what any line of code is doing out of a MUCH larger context).
At a guess it could have something to do with the "difficulty" of providing it.
P.S. I marked my answer as community wiki because I know it's not providing any useful information.
Eclipse does few c++ refactorings including 'rename'. Check out this question here on StackOverflow.
It is also possible to use Microsoft compiler with Eclipse. Check out here.
Try Eclipse and see if it fits for you.
There is a lot of fud and confusion around this issue. This amazing youtube video should clear up why C++ refactoring is hard: https://www.youtube.com/watch?v=mVbDzTM21BQ
tl;dr Google refactors their entire 100 million line C++ codebase by using a compiler (Clang + LLVM) that allows access to its intermediate format.
Bottom line, third parties are screwed here, there is no realistic way for them to refactor VS C++ unless MS outputs intermediate results the same way. If you think of it from the programming problem perspective this is obvious: in order to refactor VS C++ you have to be able to compile C++ the exact same way VS does with the same bugs, limitations, flaws, hacks, shortcuts, workarounds, etc. The usual suspects like Coderush and Resharper do not have the budget for that kind of insanity although apparently they are trying but it has been years...
http://www.jetbrains.com/resharper-cpp/
Update 2016: Resharper now does a decent job at C++ refactor. Limitations are purely for large / gigantic projects.
MS has finally done this: https://channel9.msdn.com/Shows/C9-GoingNative/GoingNative-33-C-Refactoring-in-Visual-Studio-2015#time=04m37s
They have started doing this about 10 years ago, I remember watching ms channel9 long ago.
I've been using Visual Assist X with visual studio for about one year and a half. It's an incredible tool that helps you a lot with ordinary C++ code, but it doesn't perform very well on templated code. For instance, you if have a sophisticated policy-based template design, it won't know how to rename your variables, and the project won't compile anymore.
Install plugin which enables you that functionality: https://visualstudiogallery.msdn.microsoft.com/164904b2-3b47-417f-9b6b-fdd35757d194
I'd like to point out that Qt Creator (a C++ IDE which is compatible with VC++ libraries and build system) provides symbol renaming that works very well:
You can rename symbols in all files in a project. When you rename a class, you can also change filenames that match the class name.
Qt Creator - Refactoring: Renaming Symbols
Qt Creator's rename functionality gives you a list of the symbol references it found and an opportunity to exclude any of them before performing the replace. So if it gets a symbol reference wrong, you can exclude it.
So C++ symbol renaming is possible. Coming to VS from Qt Creator I feel your pain, to the point where I've considered converting preexisting VS projects of considerable size to use Qt Creator instead.
I don't buy the argument that this is specifically hard in C++. In addition to the fact that it already works very well in Qt Creator, there's the fact that the compiler and linker can find and match symbols: If that wasn't possible you couldn't build your application.
In fact, languages like Python that are dynamically typed also have renaming tools. If you can create such a tool for a language where there are no explicit references to variable type you can definitely do it for C++.
Case in point:
... Rope, a python refactoring library... I tried it for a few renames, and that definitely worked as expected.
Stack Overflow - What refactoring tools do you use for Python?
Well in spite of comments by all you experts I totally disagree that refactoring support issue has something to do with C++ language semantics or any language semantics for that matter. Except the compiler builder themselves don't choose to implement one in first case due to their own reasons or constraints whatsoever they maybe.
And offense not to be taken but I am sorry to say Mr jsb the above link you provided to support your case (i.e of yosefk) about C++ defect is totally out of question. Its more like you providing direction to "Los angeles" when someone asked for of "San Franisco".
In my opinion raising refactoring difficulty issue for certain language is more like raising a finger on language integrity itself. Especially for languages which is sometimes just pain.... when it comes to their variable declaration and use. :) Okay! tell me how come you loose track of some node within a node tree ... eh? So what it is do with any language be it as simple as machine level code. You know you VS compiler can easily detect if some variable or routine is dead code. Got my point?
About developing third party tool. I think compiler vendors can implement it far more easily and effectively if they ever wanted to then a third party tool which will have to duplicate all the parsing database to handle it. Nowadays compiler can optimize code very efficiently at machine code level and I am hearing here that its difficult to tell how some variable is used previously. You haven't paid any real attention to inner working of compiler I suppose. What database it keep within.
And sure its the almost same database that IDE use for all such similar purposes. In previous time compiler were just a separate entity and IDE just a Text Editor with some specialization but as times goes by the gap between compiler and IDE Editor become less and its directly started working on similar parsed database. Which makes it possible to handle all those intellisense and refactoring or other syntax related issues more effectively. With all precompile things and JIT compiling this gap is almost negligent. So it almost make sense to use same database for both purpose or else your memory demand go higher due to duplication.
You all are programmers - I am not! And you guys seems to be having difficulty visualizing how refactoring can be implemented for C++ or any language that I can't comprehend. Its just all about for something you have to put more effort for some less depending on how heavy is a person you trying push.
Anyway way VS a nice IDE especially when it comes to C#.

Netbeans or Eclipse for C++? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 11 years ago.
I'm currently working on a pet project and need to do C++ development on Windows, Mac, Linux, and Solaris, and I've narrowed it down to Netbeans and Eclipse, so I was wonderig which is more solid as a C++ editor. I just need solid editing, good autocompletion for templated code ad external libraries, and project file management, the build tools are external, so thats irrelevant here, for my comparison.
Thus which is a better choice?
Note: I know I should be using emacs or vim, but the issue is, my theory at least, that I'm left handed, so I use my right side (design,creativity) of the brain more than the left side (logic, memory), so I just simply cannot use emacs or vim, my brain simply isn't compatible, I tried them many times too, even used emacs for a few months but it drove me crazy...
Thanks
I haven't used NetBeans, but Eclipse CDT (C Developer Tools, which includes C++), especially with the latest version, is really quite excellent:
Syntax checking and spell checking
Syntax highlighting that distinguishes between library calls and your function calls and between local and member variables and is even applied to code that's #ifdef'ed out
Macro expansion that can step you through each level of macro application or show the final result even of very complex Boost Preprocessor macros
A file and class outline view that updates dynamically to show where you are in a file. (Commercial IDE's I've used fail to do this.)
Powerful, flexible Find/Replace and Find in Files features with complete Perl-style regex support. It's also supposed to be able to do a C/C++ Find in Files that can search based on language semantics (e.g., only find references, not declarations), although this sometimes doesn't work for me.
Automatic tracking of TODO and other comment tags
Mouseover tips that show the exact declaration of a variable or function, including any comments, instead of just where a variable or function is declared. (Again, commercial IDE's I've used fail to do this.)
Support via plugins for Subversion, Doxygen, etc.
Some refactoring support - rename, extract constant, extract function, a few others
Code reformatter, based on user-definable code styles
You'd asked specifically about its editor; the Eclipse editor is good enough that I use it in preference to the commercial IDE for our product whenever I don't need the commercial IDE's forms designer.
Eclipse's debugger integration (using gdb) is tolerable but not great, and its memory usage is high. A few features (like the C/C++ Find in Files) don't work reliably or require reindexing (which is time consuming) for no apparent reason, but the latest version seems more reliable in this regard.
Can someone who's used NetBeans fill in how it compares?
I'm using Netbeans from time to time on Solaris and the latest (6.5) version is pretty neat. It has all the features that you need, perhaps autocompletion could work better, but I have a really bad code base so it might be the result of it. Keep in mind that you need strong machine for that, if it's your PC it's ok but Netbeans on a remote server (like I tried) is really slow unless you have a decent hardware. There are few simple refactorings for C++ with nice preview option, definitely worth a try.
You can get a whole Sun C++ pack from here:
http://developers.sun.com/sunstudio/downloads/express/
Personally I prefer NetBeans - the project management is excellent and I was up and running quicker than with Eclipse. However, it is subjective and YMMV.
They are both bloated and slow, IMHO. Why don't you try Code::Blocks instead? It is specifically aimed at C++ developers and performs much better than either Eclipse or NetBeans.
Just to give 2 cents to the comments about speed or performance issues with eclipse/netbeans:
The only part of an IDE that sucks if it is slow is the editor component.
And in contrast to some obviously superficial assertions here, I found the editor
component in Eclipse extremely snappy. The rest of the IDE is prone to lags,
but the editor itself delivers spotless performance.
I have a 1.4GHz Laptop and use Eclipse with it. Eclipse's editor component is faster (especially when scrolling/browsing through text) than Code::Blocks or KDevelop. The simple reason for this is: Eclipse caches everything, especially the syntax highlighting etc., other IDEs seem to try to do this ''live'' and fail.
The c++ indexer was a cause of woe in versions past. It crashed when out of memory, without it none of the nifty search functions worked, etc.
For the current version I can only say: It is all fixed and it works like a charm.
It's speed is comparable to the VisualStudio Indexer.
If you install Eclipse CDT you get a ton of nice features as has been explained in other replies already, that most other IDEs only provide with multiple plugins. (I don't know about netbeans, never used it.)
The feature that kicks me everytime is the smart tooltip when I hover over some identifier. Eclipse gives me direct access to any javadoc that might be entered somewhere and the file where it is defined and even lets me scroll around inside the tooltip!
So I have every identifiers full context at my fingertips, everywhere.
I prefer it over Visual Studio and pretty much everything else I've tried.
Granted, everything else you do in the IDE could be snappier. For me, the crucial thing is, that the editor is fast and eclipse's definitely does a great job there.
The only thing I hate about Netbeans is that the debugger is kinda slow in comparison to Eclipse . Besides that , Netbeans would be my choice .
If you run eclipse under linux you can use valgrind for memory leaks. Eclipse supports gdb well enough for me, but I couldn't find a decent memory leak plugin, and the valgrind integration plugin is in beta. This blog does a great tutorial for it: http://kapo-cpp.blogspot.com/2007/02/detecting-memory-leak.html . I cast my vote for eclipse on linux. P.S Real men use ed only.
The c++ parser in code::blocks doesn't seem to be on par with netbeans and eclipse ones: according to code::block's wiki, it needs to be entirely rewritten.
They're both excellent for C++ development, but one thing that I've recently found lacking in NetBeans is that there doesn't seem to be a plugin available for CppUnit, or any other C++ unit testing framework. I'd love to get some more responses to this question if I'm wrong about that.
(Also, I know development is always going on for NetBeans, so maybe someone will come up with a plugin soon.)
For C++ I'd have to agree with Nemanja Trifunovic and say you should give Code::Blocks a look. It's free, and has great performance. I started using it a few years ago after switching from Bloodshed Dev-C++ (which is basically not supported anymore) and couldn't be happier.
I'm a huge fan of Eclipse and have used it extensively for Java and C++ programming. However, currently, it does not support remote C++ development. I tried Netbeans Remote C++ development and have found it to be rather excellent and extremely simple. Having said that, the C++ parsing is not as fluid as Eclipse, the autocomplete sometimes gets in the way and doesn't go away, and the biggest problem I have had is the constant need to restart the IDE due to very slow performance. I hope Eclipse can continue to build it's Remote C++ development capabilities and use Netbeans as an example of how to make it very simple!
having used eclipse for some time now i recently took a look at netbeans and must say i quite like it. at the end of the day they are both excellent ides and it is a very subjective choice.
in my opinion netbeans seems to be a bit faster than eclipse, but that might just be a feeling.
I have been using Net Beans so far. But I was forced to switch to Eclipse due to problems in NetBeans. There is a Net Beans bug which renders the IDE useless when you work with projects with a large amount of source files. Many people have been complaining, but it seems the Net Beans team was unable to fix the problem which stops the IDE from responding when it is parsing the source files. :(
Reported in:
Petr Dvorak - Oracle Blog
As a solution they provide an on-demand parsing mechanism which does not work for me :(
Net Beans Wiki

MS VC++ 6 class wizard

Ok, I'm developing an application that has been in pretty much continous development over the last 16 years, from C in DOS, through various flavours of C++ and now is largely based around C++ with MFC and StingRay GUIs and various other SDKs.
While I use VS 2005 for the release builds, I still use MSVC 6 for much of the GUI building, simply because ClassWizard is so much quicker in this environment than the weak equivalent tools that followed. Note that I am using ClassWizard to automatically generate code for my own user defined types (see Custom DDXs) and I like to add a lot of member variables and methods in one go. Creating them one at a time as per later versions of Visual Studio for me is a big backward step. At the same time, working with multiple IDEs is also a pain.
My question is in two parts;
Is there any way of getting ClassWizard to work is VS 2005 or VS 2008?
Is there any drop in replacement, or alternative IDE, that provides similar levels of productivty for old C++ hacks such as myself?
A follow up to those who are interested. ClassWizard may be re-introduced in VS2010, from Tarek Madkour [VC++ Team]
'We are considering adding the Class
Wizard back to VS10. We hope this will
make DDX/DDV function creation more
keyboard-centric just like it was in
VC6. There are some schedule
challenges that we will need to
overcome to get the feature done, but
I am optimistic that you will see it
when we ship VS10.'
Click here for the full discussion
Edit: The release notes for VS2010 confirm that MFC Class Wizard is back. So contrary to popular belief, the guys at MS do listen to their users.
Visual Studio 2010 provides a C++ IDE
experience that includes the return of
the MFC Class Wizard, the ability to
view large source files through Source
Outline, integrated quick searching to
find information without the confusion
of the current “Find In Files” method
and an easily extensible IDE model
through the new Managed Extensibility
Framework (MEF).
Agree with Shane, the CW alternative in vs2008 is shockingly poor; it makes you wonder if anybody at Microsoft still uses MFC. I’ve started bumping my estimates up just because of the generally poor afx/mfc integration. It’s just not finished and what is there is pretty buggy. Sure you can put the code in by hand, nobody is claiming its hard but seriously, its grunt code, its 2010, you just shouldn’t be writing this stuff by hand anymore.
I will suggest avoid code generation at all and use your favorite editor to manually create new code. If i understand correctly your are expert in this area and i sure you know that manually created code will be much cleaner and simpler then the generated one.
In additional the code generator is a nightmare for code reviews, it change zillions of places that should not be changed at all and it's really hard to concentrate to the meaningful changes.
IMHO.
I would also suggest you put the neccessary DDX/DDV (as well as message handling) macros (and member variables) manually into your classes. At first it seems a bit difficult to find out how and where exactly one is supposed to write the entries, but after a short while it's rather easy. I started doing that after porting a VC6 project over to VS2005, and for exactly the same reason you gave: there is no suitable replacement for ClassWizard. However, after two years I can say that I don't miss it at all anymore.
You can write click on controls on form and add variable or event handler. It is not as good as VC6 but still. I do not see any point in writing the DDX manually.