Alex Held
Alex Held

Reputation: 123

General usage of c++ in visual studio

Is it possible to write a c++ code in Visual Studio without using c++.net?

I'm learning c++ at the moment - Using a book. But I like the Visual Studio IDE but I don't know if it supports c++ or just c++.net.

Upvotes: 0

Views: 71

Answers (3)

Rado
Rado

Reputation: 8953

Yes, you can. Visual studio supports two types of C++ applications:

  • C++/CLI (also called managed C++) - Under Visual Studio project wizard, these kind of projects are grouped under CLR

  • Native C++ - Under Visual Studio project wizard, these are the projects grouped under Win32, MFC, ATL

Note, however, that you can always turn a project from native to managed and vice versa by going into the project properties and switching on/off the Common Language Runtime Support (/clr), so make sure this option is turned off (No CLR).

Also, be aware that different C++ compilers not always support the same C++ features (even if they are part of the standard), and some C++ compilers implement their own extensions to the language. In the case of Visual Studio, it defines Microsoft Extensions to C and C++ that can be turned off (Za) to be more ANSI compliant.

Visual Studio is actually notoriously late when it comes to supporting the C++ standard. Even now, some C++11 features are not part of the latest Visual Studio so keep this in mind when wondering why something you read in a book does not work in Visual C++.

One last note. Avoid using ATL and MFC if you try to be cross-platform compatible. Even if you don't want to be cross-platform compatible, ATL and MFC are only supported by Visual C++ and using them will lock you to using Visual Studio. Now with the Community Edition, both ATL/MFC are available for free if you are an independent developer or a small company, while historically, ATL/MFC were paid-version only as they are not part of Visual Studio Express editions.

Upvotes: 1

rcgldr
rcgldr

Reputation: 28818

I usually create a new (empty) directory and copy the source file(s) into that directory, then when creating the Visual Studio project using the name of the directory. To create a standard C++ console program, choose "... console application", then click on next, clear the check boxes below "empty project", and check "empty project". Once you're into the project, click on project, and "add existing item" to add the source file name(s).

If you want 64 bit mode, you'll need to right click on the project name, then properties, then configuration manager, then new, and select x64. It doesn't matter if you do this for debug or release build, it will set x64 mode for both build modes.

Upvotes: 2

Cheers and hth. - Alf
Cheers and hth. - Alf

Reputation: 145204

It depends on which variant of Visual Studio you're using. If Express edition you want "for Desktop" in order to do ordinary standard C++. With full Visual Studio there's no problem.

Upvotes: 0

Related Questions