14

Well here's a rather stupid question. Is Visual C++ JUST an IDE?? Or is it a language on its own for win32? What exactly would be the difference between the two? This I ask because I was trying out some of my old C++ code on VC++ 2008 and it wouldn't compile.

andand
  • 17,134
  • 11
  • 53
  • 79
Laz
  • 6,036
  • 10
  • 41
  • 54
  • like 4-5 years old. Nothing complex. – Laz May 18 '10 at 19:54
  • What *kind* of compiler errors? Maybe you should post them and we can help resolve them. Without seeing it, I'm going to guess it's a build/compiler setting/option, rather than a problem with the code itself. Plain C++ shouldn't have *too* much trouble compiling and running in VC++. – FrustratedWithFormsDesigner May 18 '10 at 19:56
  • Perhaps you should instead be concerned about the specific errors you are getting? – luiscubal May 18 '10 at 19:58
  • possible duplicate: http://stackoverflow.com/questions/298016/is-it-really-worth-porting-from-vc6-vc2005-2008 (answer from that question is suitable here) – Kirill V. Lyadvinsky May 18 '10 at 20:08

7 Answers7

16

Visual C++ can be many things, including:

  1. Microsoft's C++ compiler (cl.exe, link.exe etc)
  2. The IDE (Visual Studio in C++ mode)
  3. The C runtime (MSVCRT)
  4. Other libraries (less so): MFC, ATL

As for compiling old C++ code: Visual Studio is now a fairly compliant C++ compiler. This was not always the case, such as with Visual C++ 6 or earlier. It is likely your code is not standards compliant or uses deprecated behavior, which simply doesn't work on newer compilers.

Note: this paragraph is outdated: Visual C++ is unfortunately a poor C compiler, as it does not support C99 (and never will), unless features overlap between C++ and C99. The most notable issue for many people is the lack of stdint.h.

Visual C++ supports C11 and C17 starting with Visual Studio 2019 version 16.8 Preview 3

For many years Visual Studio has only supported C to the extent of it being required for C++. Things are about to change now that a conformant token-based preprocessor has been added to the compiler. With the advent of two new compiler switches, /std:c11 and /std:c17, we are officially supporting the latest ISO C language standards.

bolov
  • 72,283
  • 15
  • 145
  • 224
Yann Ramin
  • 32,895
  • 3
  • 59
  • 82
  • 6
    One way VC still very visibly deviates from standard C++ is that it doesn't do proper two-phase parsing of templates. This can hide hilarious bugs in template code going unnoticed which leads to nasty surprises if you ever want the code to compile on a more conforming compiler. (And that could be a future version of VC.) – sbi May 18 '10 at 20:00
  • I can attest to this. I've had my fair share of bugs trying to get template meta-programming to work in that compiler which work fine in other compilers. – wheaties May 18 '10 at 20:09
  • 1
    @wheaties: That's the opposite: Other compilers, notable Comeau and also gcc, are better in parsing std C++. The problem with missing two-phase lookup is, however, that VC accepts faulty code which is (rightly) rejected by other compilers. If you're doing cross-platform development and code is written using VC, this can drive you nuts. – sbi May 20 '10 at 08:18
  • 1
    `it does not support C99 (and never will)` This is outdated. [MSVC now supports C11 and C17](https://devblogs.microsoft.com/cppblog/c11-and-c17-standard-support-arriving-in-msvc/) – phuclv Dec 18 '21 at 16:25
5

Visual C++ is an IDE. It compiles standard C++ code. However, every C++ compiler essentially creates its own version of C++. Few compilers are entirely compliant with the current standard, and they may or may not add features from the upcoming standard. In addition, they sometimes add their own extensions to the language. So, there's always a portiability risk when compiling C++ code with different compilers. However, recent versions of Visual C++ are fairly close to standards compliant, and most things which compile with it will compile with other popular compilers like gcc/g++ (and vice versa).

Jonathan M Davis
  • 37,181
  • 17
  • 72
  • 102
3

VS2008 includes both standard C++ and Microsoft's Managed C++. The standard C++ is mostly compliant with C++03 (at least that was the intent). Managed (i.e non standard) C++ is for developing .NET applications and is not (nor was it intended to be) compliant with any C++ standard.

You might want to make sure that you didn't accidentally select Managed C++ when you ported your app.

andand
  • 17,134
  • 11
  • 53
  • 79
1

Visual C++ is the name of Microsoft's IDE and compiler for the C++ programming language. Note, though, that -- like many C++ implementations -- Visual C++ has certain extensions that are not provided by C++ as well as certain areas where it fails to fully conform to the ISO C++ language standard.

Michael Aaron Safyan
  • 93,612
  • 16
  • 138
  • 200
1

VS C++ is essentially a specific type of C++.

New VS versions include newer functionality, both extensions(such as CLI), and also from newer standards, such as C++0x(type inference, etc.).

Some of that functionality might accidentally cause your code to stop working, or you could be relying on specific Visual Studio bugs that were meanwhile fixed.

luiscubal
  • 24,773
  • 9
  • 57
  • 83
1

Visual C++ contains C++ compiler which is an implementation of C++ Language Standard. Visual C++ 6 is a not conformant implementation. Visual C++ 2008 is much better. There are some changes from VC++6 to VC++2008 that's why your old code could not compile. There're some flags that allows to compile VC++6 code in VC++2008.

Here is a good question already on SO that could be helpful.

Community
  • 1
  • 1
Kirill V. Lyadvinsky
  • 97,037
  • 24
  • 136
  • 212
-1

I suppose Visual C++ includes Microsoft's library extensions.

vicatcu
  • 5,407
  • 7
  • 41
  • 65
  • thats that?? all the big deal and the vegas releases for a few header files? – Laz May 18 '10 at 19:54
  • 1
    @Ram Bhat: It's the IDE, compiler, and more than a just a "few" header files, and I *think* MS VC++ introduces some of their own syntax changes. It's not "pure" C++. – FrustratedWithFormsDesigner May 18 '10 at 19:54
  • The new version of Visual Studio is a pretty big deal in terms of their effort, and the features, etc., it provides. It's not that big of a deal in terms of the C++ language, specifically, except insofar as they are continuing to refine their standards compliance, and starting to support the upcoming C++0x standard. – jwismar May 18 '10 at 19:57
  • oh come on... seriously? -1? This was a perfectly reasonable answer to the original question – vicatcu May 18 '10 at 22:38
  • Is there any official C++ reference compiler implementation? I have had a lot more trouble adapting code that uses GCC's improvements (variable sized arrays) than VC++'s (wrong scope in for statements) – Martin Beckett May 19 '10 at 14:40