Why do i have to include stdafx.h everytime in visual C++ 2010 express. Evertime i make a project i have to include that damn header, whats so special about it and how can i avoid including it and still compile my program. I have tried to leave it out but it doesnt want to compile then givving an arror about forgetting to include stdafx.h.

And if you know how to compile a single source file without having to create a new project i will epreciate it.
I am using Visual Studio C++ express 2010

Oh and if you know where to get a good tutorial about making a simple server-client side TCP chat program in C++ with winsock2.h

Thanks...

Edited 4 Years Ago by MasterHacker110

VC++ 2010 defaults to precompiled headers which requires stdafx.h. When you create a project you can uncheck that option. If the project is already created you can turn it off in Project --> Properties (last manu item under Projects).

Oh and if you know where to get a good tutorial about making a simple server-client side TCP chat program in C++ with winsock2.h

There is no such thing as a "simple tutorial".for that, and under MS-Windows you have no other choice but to use winsock. You might find some boost libraries to replace it. Also I have not use c++11 standards yet but it might also have something new. In any event you are going to need more than just a casual working knowledge of c++ to write that program.

Edited 4 Years Ago by Ancient Dragon

Can you also tell me why when i say create a project and when i goto the main .cpp folder it is:
int _tmain(array<String> args)

and not the usual:
int main(int argc, char *args[])

and the aslo does this:
using namespace System;

As far as i know, System is a C# header.

You did not create a c++ project -- you created a CLI/C++ which is a different language.

As far as i know, System is a C# header.

No -- its also used in CLI/C++ which is another .NET language like C#. CLI/C++, C# and VC.NET are very similar languages

Edited 4 Years Ago by Ancient Dragon

Lol ok, they forgot to mention that. Can you create a c++ program without CLI then? just pure C++ in visual studio 2010 c++ express?

This question has already been answered. Start a new discussion instead.