Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Learning C++ from scratch in Visual Studio? [closed]

I need to get up to speed with C++ quite quickly (I've never used it previously) - is learning through Visual Studio (i.e. Managed C++) going to be any use? Or will I end up learning the extensions and idiosyncracies of C++ in VS, rather then the language itself?

If learning in VS is not recommended, what platform / IDE do you guys suggest?

Edit: Can anyone elaborate on what VS will hide or manage for me when coding unmanaged C++? I really need to be learning things like pointers, garbage collection and all the nuts and bolts of the low level language.. does VS abstract or hide any of this kind of stuff from you?

Thanks for all the suggestions..

like image 236
flesh Avatar asked Jul 06 '09 22:07

flesh


People also ask

Can I learn C in Visual Studio?

C++ C++, C, and assembly language development tools and libraries are available as part of Visual Studio on Windows.

How do I practice C in Visual Studio?

This is done by going to File > New > Project then selecting Visual C++ > Test > Native Unit Test Project. Make sure to choose the Add to solution option in the Solution dropdown. You can also simply right-click your solution name in the Solution Explorer and choose Add > New Project to accomplish the same task.

Is Visual Studio Code good for C?

With the addition of extensions, VSCode is a great tool for quickly accessing and editing C++ code, whether you are a beginner or an advanced developer. With the addition of an open source compiler that is native to your platform, you can use VSCode as a complete tool for building your C++ solutions.


2 Answers

Visual Studio (or the free version, Visual C++ Express) is a perfectly fine choice on Windows. On Linux, you'll probably end up using GCC. Both are fine compilers.

Visual C++ supports both "real" native C++ and C++/CLI, the managed .NET version, so if you want to learn C++, simply create a regular C++ project.

If you're concerned with learning "proper" standard C++, note that the compiler by default enables a number of Microsoft extensions, which you may want to disable. (Project properties -> C/C++ -> Language -> Disable Language Extensions).

For the record, GCC has similar extensions (which can be disabled by calling the compiler with --ansi), so this isn't just Microsoft being big and evil and nonstandard. ;)

like image 193
jalf Avatar answered Sep 28 '22 00:09

jalf


Visual Studio has a very good debugger. It has support for STL types (version 2008 is better) which will help you while debugging.

Visual Studio insists with the Microsoft specifics from the very first console project you make (New->Project->Win32 Console Application)

// test123.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"


int _tmain(int argc, _TCHAR* argv[])
{
    return 0;
}

What is stdafx.h? What is _tmain? What is _TCHAR? (BTW no need to answer them here) These are question which should not appear in the head of a novice.

That's why I suggest to use the "Empty project" checkbox in the Win32 Console Application project and then "Add new item" from Project menu and choose a cpp file which will give you a blank page where you can implement the code you read from a good C++ book.

like image 40
Cristian Adam Avatar answered Sep 28 '22 00:09

Cristian Adam