tags:

views:

975

answers:

13

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?

+19  A: 

Visual Studio is an excellent IDE for C++. If you know it from C#, it will be comfortably familiar.

RichieHindle
+31  A: 

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.

Konrad Rudolph
+1 for setting the warning level higher
Greg D
you know, that's really a pain at my work, since some developers use VS then I have to fix all their "mistakes" to make it work in UNIX again
igorgue
@igorgue: why is that *your* task? Can't you reject their code? Push for coding standards (comprising rules for the warning levels) at your workplace? Anyway, my condolence.
Konrad Rudolph
A: 

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.

Dinah
+12  A: 

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.

anon
Thanks Neil. I thought about that. I think I'm a fairly good programmer, but I'm not a genius. Would the IDE-free approach not be a very slow and painful experience?
John M Gant
Yes, I think it would be very slow, painful and downright discouraging for a programmer used to productive environments like VS.
Dave Van den Eynde
I don't suggest that you use the command line for all your projects (I use Code::Blocks for mine) but it is a good idea to understand the underlying mechanisms that the IDE is hiding from you. Certainly, you should know how to compile and link a simple 2-file app using your selected toolset from the command line.
anon
Makes sense. I'll do that. Thanks.
John M Gant
I agree with Neil. It's also worthwhile to learn how to write MSBuild projects for the same reason. It helps a lot when Visual Studio messes up (and it does, from time to time), and you need to fix it.
unforgiven3
Didn't say it's a bad idea to understand how the underlying compilation/linking happens, but by using no IDE at all, you're forcing it for all projects. Even with VS installed, you can launch a compiler manually.
Dave Van den Eynde
+4  A: 

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.

20th Century Boy
A: 

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.

sharkin
+2  A: 

Use Visual Studio, especially if you already know it through C#. I agree with the others that you should invest in Visual Assist though.

Simon H.
+1  A: 

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.

jassuncao
Visual C++ used to have lousy compliance with the C++ standard. This was certainly true in the 6.0 and 7.0 days. However, Microsoft made huge advances in 7.1 (Visual C++ .NET 2003). Modern versions of Visual C++ have very good support for standard C++. Still, as mentioned in other answers, it's a great idea to use at least two compilers and to turn up the warning levels.
ChrisInEdmonton
+1  A: 

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!

Feanor
Thanks for the link. Never heard of that one. There are some good C++ links on the site, too. Thanks a lot!
John M Gant
DEv C++ is apparently no longer being developed (and has a lot of bugs) - I suggest Code::Blocks at http://www.codeblocks.org/ instead.
anon
Appreciate the update. I'll try that one as well.
Feanor
+2  A: 

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

all of that for a new C++ programmer? as if learning C++ isn't hard enough
Idan K
You know.. Especially for a new programmer. I must say, however, that jmgant talks about having programming experience, so he, probably, already learned some thing hard way. What I mean by "Especially for a new programmer" is that it is easy to acquire bad habits, and linking yourself to msvs is a perfect example.That`s why (at least where I live) you will have analysis course even if you graduate as a programmer. When you learn -- you should walk the hardest path -- it will be easier later ;-)
A: 

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

Drew Hoskins
Also, depending on your source control system, you may be able to find a source control plugin that integrates it into the IDE.
Drew Hoskins
A: 

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.

sean riley
+1  A: 

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.

Chris