views:

345

answers:

3

(This is a probably a very beginner question and I may be missing something obvious)

I've just moved from my mac back to windows, and I'm trying to get set up with C++. I have visual studio 2008 C++: how do I compile "normal" non .net/clr C++? I want a command line application, and the only project that seemed fit was "CLR console application." My stuff works and compiles fine with Xcode or dev C++, but VS gives me 57 errors, and seems to only want me to do .net stuff. I have to include "stdafx.h" before it will even do anything. Can I just use plain old C++, with std::string and vectors, without the .net stuff? Or do I need dev c++?

thanks guys!

+6  A: 

Create a Win32 Console Application.

The Win32 part might be a bit confusing, but what it means is basically just a native C++ project (from which you can use the Win32 should you so desire - but you don't have to)

stdafx.h is the default precompiled header (which you probably don't want. I have no idea why they enable that as default, since it is completely pointless in small projects). In the project creation wizard, be sure to select "empty project", or it'll create the precompiled header plus a couple of other files you don't want or need. It can also be turned off in the project properties.

jalf
beaten by 7 seconds...
rmeador
btw, it's worth noting that if you don't want to use stdafx.h, you should turn off "precompiled header" under the Application Settings of the project creation wizard.
rmeador
A: 

Select General->Empty project project type.

Dmitry Risenberg
A: 

The file "stdafx.h" is the default name Visual Studio gives to the precompiled header for a console project. If you opt to create a project without precompiled headers when going through the new project wizard there will be no need to include it. Precompiled headers are useful for reducing build times on large projects but not necessary for a small app.

mattnewport