2

By default Microsoft's Visual Studio is using <tchar.h> and defines main as int _tmain(int argc, _TCHAR* argv[]). This can be usefull but not always.

How to disable this in default new project?

UPDATE

I want to create empty projects with simple mains...

Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385
  • What do you mean by "disable" it? Do you want to have the wizard generate different code or you asking how to setup a project that's explicitly ansi/wchar? – user786653 Dec 17 '12 at 17:21
  • 1
    Depending on your project settings TCHAR defaults to char for mutlibyte or wchar_t for unicode projects. You can always rewrite main as int main() or int main(int argc, char* argv[]) and override this without having to worry about TCHAR. – johnathan Dec 17 '12 at 17:21

2 Answers2

3

To create an empty project and use plain old main:

  1. In Visual Studio, choose File -> New -> Project...
  2. Select Console Application and give it a name.
  3. In the Wizard, choose Application Settings.
  4. Select Empty project.
  5. Click Finish.
  6. Add a .cpp file to the project.
  7. In the new .cpp file, implement main.

For example:

#include <iomanip>    
#include <iostream>

int main(int cArgs, char **ppszArgs) {
  std::cout << "Hello, World!" << std::endl;
  return 0;
}
Adrian McCarthy
  • 45,555
  • 16
  • 123
  • 175
2

Here is a howto guide from MSDN.

user93353
  • 13,733
  • 8
  • 60
  • 122