Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Understanding _tmain in Visual C++ console projects

Tags:

c++

visual-c++

In Visual C++ 2008 Express, when I create a new console project I get the following program to start with:

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

//

#include "stdafx.h"

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

I have a few questions about it:

  • Why is the main function _tmain instead of main?

  • I'd thought the argv parameter was supposed to be char* argv[] instead of _TCHAR.

  • What's stdafx.h?

This doesn't really feel like the same C++ I'm used to.

like image 659
Whovian Avatar asked May 04 '12 15:05

Whovian


1 Answers

Take a look here for _tmain... etc.

What is the difference between _tmain() and main() in C++?

stdafx.h is a precompiled header (optional) for Windows applications. More here:

http://en.wikipedia.org/wiki/Precompiled_header

like image 126
Inisheer Avatar answered Oct 14 '22 05:10

Inisheer