12

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?

John M Gant
  • 18,970
  • 18
  • 64
  • 82
  • This question has been put on hold after nine years. Interesting. FWIW, Konrad's and Neil's answers were, in fact, based on expert expertise and both proved to be very helpful to me at the time. – John M Gant Jan 07 '19 at 21:16

13 Answers13

34

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
  • 530,221
  • 131
  • 937
  • 1,214
  • 7
    +1 for setting the warning level higher – Greg D May 04 '09 at 14:13
  • 1
    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 May 04 '09 at 19:06
  • 3
    @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 May 04 '09 at 20:09
20

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

RichieHindle
  • 272,464
  • 47
  • 358
  • 399
16

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.

  • 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 May 04 '09 at 14:12
  • 1
    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 May 04 '09 at 14:13
  • 2
    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. –  May 04 '09 at 14:15
  • Makes sense. I'll do that. Thanks. – John M Gant May 04 '09 at 14:18
  • 2
    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. – Rob May 04 '09 at 14:24
  • 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 May 04 '09 at 14:31
  • +1 Linux + gcc + Nano = Happiness – James May 03 '13 at 14:44
  • Writing functions with a reasonable size (no more than about 15 lines) without an IDE is a pain. Because of this, people who code without an IDE very often produce a terrible code with functions above 1000 lines and more in source files containing hundreds of thousands of lines. – Marian Spanik Dec 18 '15 at 13:31
3

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.

PowerApp101
  • 1,798
  • 1
  • 18
  • 25
  • 1
    If I had to work on Windows, even for code that just needs to run on Windows, I would use something portable, just in case. The future is hard to predict... – Pietro Aug 22 '12 at 12:38
2

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.
  • 541
  • 4
  • 11
2

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 May 04 '09 at 19:17
  • 1
    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 ;-) –  May 04 '09 at 23:02
1

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
  • 4,695
  • 3
  • 30
  • 35
  • 1
    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 May 04 '09 at 15:06
1

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
  • 2,715
  • 4
  • 29
  • 43
  • 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 May 04 '09 at 15:04
  • DEv C++ is apparently no longer being developed (and has a lot of bugs) - I suggest Code::Blocks at http://www.codeblocks.org/ instead. –  May 04 '09 at 15:13
  • Appreciate the update. I'll try that one as well. – Feanor May 04 '09 at 15:17
1

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
  • 6,702
  • 8
  • 44
  • 60
0

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.

Community
  • 1
  • 1
Dinah
  • 52,922
  • 30
  • 133
  • 149
0

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
  • 12,162
  • 24
  • 86
  • 122
0

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
  • 4,168
  • 20
  • 23
  • 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 May 04 '09 at 17:22
0

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
  • 2,633
  • 1
  • 22
  • 22