开发者

Microsoft C++ compiler is too annoying! Is there an alternative for compiling for Windows 32/64bit?

开发者 https://www.devze.com 2023-03-31 17:15 出处:网络
I am so frustrated with the Microsoft C++ compiler (not Visual). I am really annoyed at how it uses int _tmain(

I am so frustrated with the Microsoft C++ compiler (not Visual). I am really annoyed at how it uses

int _tmain(

and

_TCHAR* argv[]

as well as many other things. I just want to use straight C++ like you would in GCC. Is there an alternative?

Thanks to all the responses. I was really just looking for a way of not using Microsoft Style code. This is what helped me -

  1. Remove #include "stdafx.h"
  2. Rename main method to -

int main (int argc, ch开发者_如何学Car* argv[]) { return 0; }

And it works!


You don't have to use _tmain() and TCHAR if you do not want to. Just create an empty project, add an empty source file to it and start writing

int main(int argc, char* argv[])
{
}

On VC++ 2010 Express you can just compile and execute it straight away. I don't remember if previous versions require that you set the project type.


You can try MinGW-32/64 for windows.


The _tmain/_TCHAR stuff is optional (you can read more about this on MSDN, Generic-Text Mappings in Tchar.h). You can delete the tchar.h file and #include from your project and directly use wmain/wchar_t (or main/char for ANSI) if you so choose.


You can get gcc for Windows. Look at the cygwin site. I know MS lets you use _tmain, TCHAR etc, but its the first I've heard that it actually requires you do to so, are you sure you're not missing some option somehere?


You can try gcw and MinGW but I have had varying results with both so YMMV...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号